kernel32: Don't crash accessing an invalid handle in GlobalSize

Robert Shearman rob at codeweavers.com
Tue Sep 18 03:13:27 CDT 2007


James Hawkins wrote:
> +      if (IsBadReadPtr(pintern, 1))
> +      {
> +         SetLastError(ERROR_INVALID_HANDLE);
> +         return 0;
> +      }
> +
>        if(pintern->Magic==MAGIC_GLOBAL_USED)
>        {
>           if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */

It would be better to wrap the Magic access with an exception handler 
rather than use IsBadReadPtr.

-- 
Rob Shearman




More information about the wine-devel mailing list