cygwin_create_path causes null pointer crashes

Thomas Wolff towo@towo.net
Wed Dec 14 20:25:00 GMT 2016


Am 13.12.2016 um 12:56 schrieb Corinna Vinschen:
> On Dec 12 20:28, Thomas Wolff wrote:
>> Hi Corinna,
>>
>> Am 11.12.2016 um 12:08 schrieb Corinna Vinschen:
>>> Hi Thomas,
>>>
>>> On Dec 10 03:03, Thomas Wolff wrote:
>>>> cygwin_create_path is supposed to call malloc itself,
>>>> however, it occasionally returns with null and errno == ENOSPC,
>>>> if it's provided with a network path, e.g.
>>>> cygwin_create_path(CCP_POSIX_TO_WIN_W, "/cygdrive/s/.config/mintty")
>>>> returns null in ~ 3 of 1000 cases, where /cygdrive/s exists but
>>>> /cygdrive/s/.config does not
>>> Did you try to debug and fix the issue?  This is the developer's mailing
>>> list after all...
>> I can contribute some initial analysis:
>> Cloning cygwin_create_path from cygwin/path.cc with these essentials:
>>    ssize_t size = cygwin_conv_path (what, from, NULL, 0);
>>    // checking size, calling malloc
>>    if (cygwin_conv_path (what, from, to, size) == -1)
> Cloning?  Why didn't you just debug with GDB and/or strace?
Well, one reason is that I had to manipulate the value of size between 
the two calls ...

>> ...
> A simple strace shows that there's a really ugly problem with network shares:
>
> ...
> Anyway, we can't fix Windows, but we can workaround its problems, which
> is what Cygwin does, so I applied a patch.
Great, this works, thanks.

Thomas



More information about the Cygwin-developers mailing list