[PATCH 1/5] ddraw: Protect against invalid clipper pointers.

Stefan Dösinger stefan at codeweavers.com
Thu Mar 7 13:12:33 CST 2019



> Am 05.03.2019 um 23:16 schrieb Henri Verbeet <hverbeet at gmail.com>:
> 
> That's pretty ugly.
I know. But which part do you think could be improved in particular? Moving the extra checks out of impl_from_IDirectDrawClipper to keep it in line with the standard way we do COM objects?

> Would it work to introduce a helper along the lines of the floowing?
> 
>    static BOOL ddraw_clipper_is_valid(struct ddraw_clipper *clipper)
>    {
>        return !IsBadReadPtr(clipper, sizeof(*clipper))
>                && clipper->IDirectDrawClipper_iface.lpVtbl ==
> &ddraw_clipper_vtbl;
>    }
The vtable only matters for Release(), the rest of the methods don't care if you change the vtable, that's why I added the magic value.

If we only care about fixing Deus Ex for now I could set the vtable to NULL on release and add a try-catch around the clipper release in ddraw_surface_wined3d_object_destroyed. That would be less invasive, but we couldn't add the test because it would crash.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190308/22b703a8/attachment.sig>


More information about the wine-devel mailing list