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

Dmitry Timoshkov dmitry at codeweavers.com
Thu Sep 20 00:34:33 CDT 2007


"James Hawkins" <truiken at gmail.com> wrote:

> This version compares the pointer value to 64000 instead of using a
> try/catch block, as suggested by Alexandre.

> -      if(pintern->Magic==MAGIC_GLOBAL_USED)
> +      if(pintern > (PGLOBAL32_INTERN)64000 && pintern->Magic==MAGIC_GLOBAL_USED)
>        {
>           if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */

It should be either 65535 (0xffff), or a test for HIWORD(pintern) being 0.
Also the cast should be to (char *) on both sides rather than (PGLOBAL32_INTERN).

-- 
Dmitry.



More information about the wine-devel mailing list