Fix Cast(vkFence) crashing on Windows
Fence has a second base class with virtual functions, but its first base does not.
In "static VkResult Create(...), when assigning the handle via:
*outObject = *object;
since this is code run in the context of the first base class, the address returned
is offset by sizeof the vtable pointer from the second base class (8 bytes on x64).
Problem is that the Cast overload for Fence does a simple reinterpret_cast of this
stored pointer back to Fence*, without the offset being taken into account. The
fix is to simply first cast the stored pointer back to the first base class type, and
then static_cast it to the derived Fence type.
Bug: b/117835459
Change-Id: Ieb2856320e996a5ad5d9e69aad5e01cfaee1cd9e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31988Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Showing
Please
register
or
sign in
to comment