flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

[C++, clang-1400.0.29.202] Flexbuffers AsanDie on calling EndMap

Open dirkschulze opened this issue 2 years ago • 1 comments

When building Flexbuffers with sanitizer + C++17 enabled, we see AsanDie when calling EndMap:

0   libsystem_kernel.dylib        	    0x7ff80b1787a6 __pthread_kill + 10
1   libsystem_pthread.dylib       	    0x7ff80b1b0f30 pthread_kill + 262
2   libsystem_c.dylib             	    0x7ff80b0cfa4d abort + 126
3   libclang_rt.asan_osx_dynamic.dylib	       0x1214d9556 __sanitizer::Abort() + 70
4   libclang_rt.asan_osx_dynamic.dylib	       0x1214d8c84 __sanitizer::Die() + 196
5   libclang_rt.asan_osx_dynamic.dylib	       0x1214bc197 __asan::ScopedInErrorReport::~ScopedInErrorReport() + 1207
6   libclang_rt.asan_osx_dynamic.dylib	       0x1214bb437 __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) + 1719
7   libclang_rt.asan_osx_dynamic.dylib	       0x1214872ee wrap_memcpy + 718
8   xxxxxxxxxx                    	       0x115cfaa9f std::__1::enable_if<__is_cpp17_forward_iterator<unsigned char const*>::value && is_constructible<unsigned char, std::__1::iterator_traits<unsigned char const*>::reference>::value, std::__1::__wrap_iter<unsigned char*>>::type std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>::insert<unsigned char const*>(std::__1::__wrap_iter<unsigned char const*>, unsigned char const*, unsigned char const*) + 239
9   xxxxxxxxxx                    	       0x114a886b8 void flexbuffers::Builder::Write<unsigned long long>(unsigned long long, unsigned long) + 196
10  xxxxxxxxxx                    	       0x114a86450 flexbuffers::Builder::CreateVector(unsigned long, unsigned long, unsigned long, bool, bool, flexbuffers::Builder::Value const*) + 932
11  xxxxxxxxxx                    	       0x114a85e89 flexbuffers::Builder::EndMap(unsigned long) + 385

Source is calling WriteBytes.

  template<typename T> void Write(T val, size_t byte_width) {
    FLATBUFFERS_ASSERT(sizeof(T) >= byte_width);
    val = flatbuffers::EndianScalar(val);
    WriteBytes(&val, byte_width);
  }
libclang_rt.asan_osx_dynamic.dylib`__asan::AsanDie:
->  0x1206e1fa0 <+0>:   pushq  %rbp
    0x1206e1fa1 <+1>:   movq   %rsp, %rbp
    0x1206e1fa4 <+4>:   pushq  %rbx
    0x1206e1fa5 <+5>:   pushq  %rax
    0x1206e1fa6 <+6>:   lock   
    0x1206e1fa7 <+7>:   addl   $0x1, 0x5cd8e(%rip)       ; __asan::UnpoisonStack(unsigned long, unsigned long, char const*)::reported_warning + 3
    0x1206e1fae <+14>:  leaq   0xa5f3e3(%rip), %rax      ; __sanitizer::common_flags_dont_use

We started seeing the issue moving to C++17 and Xcode 14.2.0 (clang-1400.0.29.202).

dirkschulze avatar Nov 15 '23 08:11 dirkschulze

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] avatar May 15 '24 20:05 github-actions[bot]

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.

github-actions[bot] avatar May 30 '24 20:05 github-actions[bot]