Jump to content
TrinityCore

Compilation with -fsanitize=address


JohnyWroc
 Share

Recommended Posts

Hi,

After compilation of trinity (TrinityCore rev. 9f9f32b193c6+ 2017-11-20 07:56:03 +0100 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon))

with option -fsanitize=address and -fsanitize=leak I got an error during execution:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>> Loaded 1068 trinity strings in 169 ms
Initialize data stores...
 

=================================================================
==3482==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fdd23999881 at pc 0x00000576b5e0 bp 0x7ffd758523b0 sp 0x7ffd758523a8
READ of size 4 at 0x7fdd23999881 thread T0
    #0 0x576b5df in DB2FileLoaderRegularImpl::RecordGetVarInt(unsigned char const*, unsigned int, unsigned int, bool) const /home/maciek/trinity/src/common/DataStores/DB2FileLoader.cpp:719
    #1 0x576e910 in DB2FileLoaderRegularImpl::AutoProduceData(unsigned int&, char**&, std::vector<char*, std::allocator<char*> >&) /home/maciek/trinity/src/common/DataStores/DB2FileLoader.cpp:357
    #2 0x4f16e75 in DB2StorageBase::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, char**&) /home/maciek/trinity/src/server/shared/DataStores/DB2Store.cpp:140
    #3 0x30972ca in void LoadDB2<TransmogSetItemEntry, DB2Storage>(unsigned int&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::map<unsigned int, DB2StorageBase*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, DB2StorageBase*> > >&, DB2StorageBase*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, DB2Storage<TransmogSetItemEntry> const&) /home/maciek/trinity/src/server/game/DataStores/DB2Stores.cpp:393
    #4 0x2e0900d in DB2Manager::LoadStores(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) /home/maciek/trinity/src/server/game/DataStores/DB2Stores.cpp:658
    #5 0x4b9230f in World::SetInitialWorldSettings() /home/maciek/trinity/src/server/game/World/World.cpp:1567
    #6 0xef9e3f in main /home/maciek/trinity/src/server/worldserver/Main.cpp:255
    #7 0x7fdd4c03cf49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
    #8 0x1002689 in _start (/opt/trinity/bin/worldserver+0x1002689)
0x7fdd23999884 is located 0 bytes to the right of 241796-byte region [0x7fdd2395e800,0x7fdd23999884)
allocated by thread T0 here:
    #0 0x7fdd4f1f7e10 in operator new[](unsigned long) (/usr/lib64/libasan.so.4+0xdde10)
    #1 0x5767af7 in DB2FileLoaderRegularImpl::Load(DB2FileSource*, DB2FileLoadInfo const*, DB2Header const*) /home/maciek/trinity/src/common/DataStores/DB2FileLoader.cpp:239
    #2 0x62d53e2 in typeinfo name for WorldPacketCrypt (/opt/trinity/bin/worldserver+0x62d53e2)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/maciek/trinity/src/common/DataStores/DB2FileLoader.cpp:719 in DB2FileLoaderRegularImpl::RecordGetVarInt(unsigned char const*, unsigned int, unsigned int, bool) const
Shadow bytes around the buggy address:
  0x0ffc2472b2c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffc2472b2d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffc2472b2e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffc2472b2f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffc2472b300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0ffc2472b310:[04]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc2472b320: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc2472b330: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc2472b340: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc2472b350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffc2472b360: 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
==3482==ABORTING
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
GCC: 
 gcc -v
Using built-in specs.
Reading specs from /usr/lib64/gcc/x86_64-suse-linux/7/defaults.spec
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --enable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 7.2.1 20171020 [gcc-7-branch revision 253932] (SUSE Linux)
Using Boost version: 1.65.1
Automatic database updates are disabled for all databases!
Opening DatabasePool 'trinity_auth'. Asynchronous connections: 1, synchronous connections: 1.
MySQL client library: 5.7.20
MySQL server ver: 5.7.20
 
And another error related to memory leak:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
==3475==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7f57635befb0 in operator new(unsigned long, std::nothrow_t const&) (/usr/lib64/libasan.so.4+0xddfb0)
    #1 0x112b808 in soap_instantiate_SOAP_ENV__Fault(soap*, int, char const*, char const*, unsigned long*) /home/maciek/trinity/dep/gsoap/soapC.cpp:786
Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f57635befb0 in operator new(unsigned long, std::nothrow_t const&) (/usr/lib64/libasan.so.4+0xddfb0)
    #1 0x112bc90 in soap_instantiate_SOAP_ENV__Detail(soap*, int, char const*, char const*, unsigned long*) /home/maciek/trinity/dep/gsoap/soapC.cpp:998
SUMMARY: AddressSanitizer: 96 byte(s) leaked in 2 allocation(s).
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
need to be fixed

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...