Are you sure everything is compiled with the same options? Turning on the ASan for parts of a binary is usually wrong, since it changes the ABI of the types and you will have mismatch. You might have an ODR violation where part of your binary is built with ASan and another without. >From the difference in sizes it seems to me that the code that is calling `new DynamicMessageFactory` is built with ASan, but protobuf itself is built without.
On Wed, Jun 26, 2024 at 10:26 AM Joseph Khell <[email protected]> wrote: > Running the following code with address sanitizer: > > google::protobuf::DynamicMessageFactory* dynamic_message_factory = new > google::protobuf::DynamicMessageFactory; > delete dynamic_message_factory; > > Causes the sanitizer to complain about new-delete type mismatch: > > ==26==ERROR: AddressSanitizer: new-delete-type-mismatch on 0xffff9661d9a0 > in thread T0: > object passed to delete has wrong type: > size of the allocated type: 88 bytes; > size of the deallocated type: 64 bytes. > #0 0xffff9c8b6100 in operator delete(void*, unsigned long) > ../../../../src/libsanitizer/asan/asan_new_delete.cpp:164 > #1 0xaaab09291a48 in > google::protobuf::DynamicMessageFactory::~DynamicMessageFactory() > (/project/test+0x202c1a48) > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/a2075a00-d547-4116-ab60-035e7cceefe5n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/a2075a00-d547-4116-ab60-035e7cceefe5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAM9aRsKRZ53tJv9NKuxvT1fmCDvmvXNQX8ZgbQxSP%2BStd%3Dw5_Q%40mail.gmail.com.
