You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> clang++ -fsanitize=undefined,vptr vptr_test.cpp -o vptr_test.exe -lole32
> vptr_test.exevptr_test.cpp:8:17: runtime error: member call on address 0x0255481a1ca0 which does not point to an object of type 'IShellLinkW'0x0255481a1ca0: note: object has a possibly invalid vptr: abs(offset to top) too big fe 7f 00 00 c8 8a 59 2f fe 7f 00 00 88 8a 59 2f fe 7f 00 00 68 8a 59 2f fe 7f 00 00 20 8a 59 2f ^~~~~~~~~~~~~~~~~~~~~~~ possibly invalid vptrSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vptr_test.cpp:8:17vptr_test.cpp:10:17: runtime error: member call on address 0x0255481a1ca0 which does not point to an object of type 'IUnknown'0x0255481a1ca0: note: object has a possibly invalid vptr: abs(offset to top) too big fe 7f 00 00 c8 8a 59 2f fe 7f 00 00 88 8a 59 2f fe 7f 00 00 68 8a 59 2f fe 7f 00 00 20 8a 59 2f ^~~~~~~~~~~~~~~~~~~~~~~ possibly invalid vptrSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vptr_test.cpp:10:17vptr_test.cpp:13:19: runtime error: member call on address 0x0255481a1cb8 which does not point to an object of type 'IPersistFile'0x0255481a1cb8: note: object has a possibly invalid vptr: abs(offset to top) too big fe 7f 00 00 20 8a 59 2f fe 7f 00 00 00 8a 59 2f fe 7f 00 00 c0 89 59 2f fe 7f 00 00 88 89 59 2f ^~~~~~~~~~~~~~~~~~~~~~~ possibly invalid vptrSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior vptr_test.cpp:13:19
Maybe the reports are correct in the strictest sense, but this is fundamentally how COM works on Windows. This practically makes the vptr check unusable if any code uses any native APIs that are accessed through COM interfaces. Could it be possible for UBSan to detect that these types are COM interfaces (say, checks that the type inherits IUnknown) and suppress the check?
The text was updated successfully, but these errors were encountered:
When calling member functions of COM interfaces, the vptr check gets triggered. Demo:
Using llvm-mingw:
Maybe the reports are correct in the strictest sense, but this is fundamentally how COM works on Windows. This practically makes the
vptr
check unusable if any code uses any native APIs that are accessed through COM interfaces. Could it be possible for UBSan to detect that these types are COM interfaces (say, checks that the type inheritsIUnknown
) and suppress the check?The text was updated successfully, but these errors were encountered: