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

James Hawkins truiken at gmail.com
Thu Sep 20 00:39:01 CDT 2007


On 9/20/07, Dmitry Timoshkov <dmitry at codeweavers.com> wrote:
> "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).
>

I'll go with HIWORD(pintern), thanks for the suggestion.  I knew it
wasn't quite right :)

-- 
James Hawkins



More information about the wine-devel mailing list