byronknoll / cmix

cmix is a lossless data compression program aimed at optimizing compression ratio at the cost of high CPU/memory usage.
http://www.byronknoll.com/cmix.html
GNU General Public License v3.0
601 stars 44 forks source link

[BUG]: ERROR alloc-dealloc-mismatch #53

Closed SophrosyneX closed 1 year ago

SophrosyneX commented 1 year ago

Crash Inputs

Here is the crash file that trigger the error cmix_asan_crash_alloc-dealloc-mismatch.zip

Bug Description:

When executing cmix (new release version) with the file inputs and parameter "-n", the ASan (Memory Sanitizer ) instrumented program terminates with Nonfatal Error shown below.

Detected block types: DEFAULT: 100.0%
94 bytes -> 78 bytes in 11.84 s.
cross entropy: 6.638
=================================================================
==43536==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x611000011fc0
    #0 0x4fb322 in operator delete(void*) (/cmix/cmix_asan+0x4fb322)
    #1 0x620b7b in paq8::OLS<double, unsigned char, true>::~OLS() /cmix/src/models/paq8.cpp:1426:5
    #2 0x41d8c0 in __cxx_global_array_dtor.138 /cmix/src/models/paq8.cpp:4480:77
    #3 0x7f0b30afc030 in __run_exit_handlers /build/glibc-CVJwZb/glibc-2.27/stdlib/exit.c:108
    #4 0x7f0b30afc129 in exit /build/glibc-CVJwZb/glibc-2.27/stdlib/exit.c:139
    #5 0x7f0b30adac8d in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344
    #6 0x41f819 in _start (/cmix/cmix_asan+0x41f819)

0x611000011fc0 is located 0 bytes inside of 256-byte region [0x611000011fc0,0x6110000120c0)
allocated by thread T0 here:
    #0 0x4fa872 in operator new[](unsigned long) (/cmix/cmix_asan+0x4fa872)
    #1 0x6205e5 in paq8::OLS<double, unsigned char, true>::OLS(int, int, double, double) /cmix/src/models/paq8.cpp:1416:9

SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/cmix/cmix_asan+0x4fb322) in operator delete(void*)

Step to reproduce

byronknoll commented 1 year ago

Thanks for the bug report, fixed.