comctl32: Don't crash when getting a bad image list handle. (try 2)
Francois Gouget
fgouget at free.fr
Mon Sep 19 09:09:29 CDT 2011
On Mon, 19 Sep 2011, Nikolay Sivov wrote:
[...]
> > static inline BOOL is_valid(HIMAGELIST himl)
> > {
> > - return himl&& himl->lpVtbl ==&ImageListImpl_Vtbl;
> > + BOOL valid;
> > + __TRY
> > + {
> > + valid = himl&& himl->lpVtbl ==&ImageListImpl_Vtbl;
> > + }
> > + __EXCEPT_PAGE_FAULT
> > + {
> > + valid = FALSE;
> > + }
> > + __ENDTRY
> > + return valid;
> > }
> Maybe use IsBadReadPtr() with sizeof(void*) is better? You need only vtable
> pointer to be accessible.
I prefer this construct as using IsBadReadPtr() would introduce a race
in is_valid(). Of course calling is_valid() is in itself racy anyway. So
I don't mind switching over if that's preferred (the code would have
fewer lines).
--
Francois Gouget <fgouget at free.fr> http://fgouget.free.fr/
E-Voting: Those who cast the votes decide nothing.
Those who count the votes decide everything.
More information about the wine-devel
mailing list