flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

recently build Flatbuffers project failed on release configuration on windows_x64.[C++, master]

Open Vincent9802 opened this issue 3 years ago • 0 comments

Hi All,

Flatbuffers failed on release configuration with MSVC on windows x64. Could you please help look at this issue or provide some workarounds? Thanks in advance.

Error message

==349780==ERROR: AddressSanitizer: container-overflow on address 0x1203b67a89f5 at pc 0x7ff6b3f1018c bp 0x0024864f4a30 sp 0x0024864f41c0 WRITE of size 14 at 0x1203b67a89f5 thread T0 #0 0x7ff6b3f101ba in __asan_memmove D:\a01_work\2\s\src\vctools\asan\llvm\compiler-rt\lib\asan\asan_interceptors_memintrinsics.cpp:30 #1 0x7ff6b3c93d02 in std::basic_string<char, struct std::char_traits, class std::allocator>::replace(unsigned __int64, unsigned __int64, char const *const, unsigned __int64) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x140123d02) #2 0x7ff6b3c4ac19 in flatbuffers::cpp::CppGenerator::GenBuilders(struct flatbuffers::StructDef const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1400dac19) #3 0x7ff6b3c6fcee in flatbuffers::cpp::CppGenerator::GenTable(struct flatbuffers::StructDef const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1400ffcee) #4 0x7ff6b3c8eecf in flatbuffers::cpp::CppGenerator::generate(void) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x14011eecf) #5 0x7ff6b3c834ff in flatbuffers::GenerateCPP(class flatbuffers::Parser const &, class std::basic_string<char, struct std::char_traits, class std::allocator> const &, class std::basic_string<char, struct std::char_traits, class std::allocator> const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1401134ff) #6 0x7ff6b3e59616 in flatbuffers::FlatCompiler::Compile(int, char const **) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1402e9616) #7 0x7ff6b3e6044e in main (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1402f044e) #8 0x7ff6b3f5f47f in __scrt_common_main_seh D:\a01_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 #9 0x7ff9f4397973 (C:\Windows\System32\KERNEL32.DLL+0x180017973) #10 0x7ff9f690a2f0 (C:\Windows\SYSTEM32\ntdll.dll+0x18005a2f0)

     0x1203b67a8a00 is located 0 bytes to the right of 32-byte region [0x1203b67a89e0,0x1203b67a8a00)
     allocated by thread T0 here:
         #0 0x7ff6b3f2bd2a in operator new(unsigned __int64) D:\a01\_work\2\s\src\vctools\asan\llvm\compiler-rt\lib\asan\asan_win_new_scalar_thunk.cpp:41
         #1 0x7ff6b3b8c690 in std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>::_Construct<2, char const *>(char const *const, unsigned __int64) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x14001c690)
         #2 0x7ff6b3c4ab9e in flatbuffers::cpp::CppGenerator::GenBuilders(struct flatbuffers::StructDef const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1400dab9e)
         #3 0x7ff6b3c6fcee in flatbuffers::cpp::CppGenerator::GenTable(struct flatbuffers::StructDef const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1400ffcee)
         #4 0x7ff6b3c8eecf in flatbuffers::cpp::CppGenerator::generate(void) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x14011eecf)
         #5 0x7ff6b3c834ff in flatbuffers::GenerateCPP(class flatbuffers::Parser const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1401134ff)
         #6 0x7ff6b3e59616 in flatbuffers::FlatCompiler::Compile(int, char const **) (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1402e9616)
         #7 0x7ff6b3e6044e in main (F:\gitP\google\flatbuffers\build_amd64\Release\flatc.exe+0x1402f044e)
         #8 0x7ff6b3f5f47f in __scrt_common_main_seh D:\a01\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
         #9 0x7ff9f4397973  (C:\Windows\System32\KERNEL32.DLL+0x180017973)
         #10 0x7ff9f690a2f0  (C:\Windows\SYSTEM32\ntdll.dll+0x18005a2f0)

     HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_overflow=0.
     If you suspect a false positive see also: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow.
     SUMMARY: AddressSanitizer: container-overflow D:\a01\_work\2\s\src\vctools\asan\llvm\compiler-rt\lib\asan\asan_interceptors_memintrinsics.cpp:30 in __asan_memmove
     Shadow bytes around the buggy address:
       0x043e2d4750e0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
       0x043e2d4750f0: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
       0x043e2d475100: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
       0x043e2d475110: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
       0x043e2d475120: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
     =>0x043e2d475130: fd fd fd fd fa fa 00 00 05 fc fa fa 00 00[05]fc
       0x043e2d475140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
       0x043e2d475150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
       0x043e2d475160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
       0x043e2d475170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
       0x043e2d475180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     Shadow byte legend (one shadow byte represents 8 application bytes):
       Addressable:           00
       Partially addressable: 01 02 03 04 05 06 07 
       Heap left redzone:       fa
       Freed heap region:       fd
       Stack left redzone:      f1
       Stack mid redzone:       f2
       Stack right redzone:     f3
       Stack after return:      f5
       Stack use after scope:   f8
       Global redzone:          f9
       Global init order:       f6
       Poisoned by user:        f7
       Container overflow:      fc
       Array cookie:            ac
       Intra object redzone:    bb
       ASan internal:           fe
       Left alloca redzone:     ca
       Right alloca redzone:    cb
       Shadow gap:              cc
     ==349780==ABORTING

Steps to reproduce the issue

  1. git clone https://github.com/google/flatbuffers.git F:\gitP\google
  2. set VSCMD_SKIP_SENDTELEMETRY=1 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64 & set CL= /fsanitize=address /GS- /wd5072 & set LINK= /InferASanLibs /incremental:no /debug
  3. mkdir&cd F:\gitP\google\flatbuffers\build_amd64
  4. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DCMAKE_BUILD_TYPE=Release .. 2>&1
  5. msbuild /m /p:Platform=x64 /p:Configuration=Release FlatBuffers.sln /t:Rebuild 2>&1

Expected vs. actual results Expected build pass Actual results: build.log

Vincent9802 avatar Jun 17 '22 11:06 Vincent9802