[PATCH] Fixed crash on wine by adding NULL check after memchr

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jan 13 15:35:00 GMT 2020


On Jan  7 16:34, Arseniy Lartsev wrote:
> This is not a joke, there are vendors out there who build software for cygwin
> only. Besides, this NULL check is good to have anyway.
> ---
>  winsup/cygwin/path.cc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
> index b5efd61b2..c8e73c64c 100644
> --- a/winsup/cygwin/path.cc
> +++ b/winsup/cygwin/path.cc
> @@ -4307,6 +4307,8 @@ find_fast_cwd_pointer ()
>    const uint8_t *use_cwd = rcall + 5 + offset;
>    /* Find first `push %edi' instruction. */
>    const uint8_t *pushedi = (const uint8_t *) memchr (use_cwd, 0x57, 32);
> +  if (!pushedi)
> +    return NULL;
>    /* ...which should be followed by `mov crit-sect-addr,%edi' then
>       `push %edi', or by just a single `push crit-sect-addr'. */
>    const uint8_t *movedi = pushedi + 1;
> -- 
> 2.17.1

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200113/aeecf3e3/attachment.sig>


More information about the Cygwin-patches mailing list