tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
330 stars 97 forks source link

A malloc size error in mat.c:179:28 #143

Closed seviezhou closed 3 years ago

seviezhou commented 3 years ago

System info

Ubuntu X64, gcc (Ubuntu 5.5.0-12ubuntu1), matdump (latest master 7a1831)

Command line

./tools/matdump @@

AddressSanitizer output

==3586==WARNING: AddressSanitizer failed to allocate 0x4b350200000 bytes
==3586==AddressSanitizer's allocator is terminating the process instead of returning 0
==3586==If you don't like this behavior set allocator_may_return_null=1
==3586==AddressSanitizer CHECK failed: /build/llvm-toolchain-6.0-QjOn7h/llvm-toolchain-6.0-6.0/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:225 "((0)) != (0)" (0x0, 0x0)
    #0 0x4e37f5 in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/seviezhou/matio/tools/matdump+0x4e37f5)
    #1 0x5010a5 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/seviezhou/matio/tools/matdump+0x5010a5)
    #2 0x4e9be6 in __sanitizer::ReportAllocatorCannotReturnNull() (/home/seviezhou/matio/tools/matdump+0x4e9be6)
    #3 0x4e9c26 in __sanitizer::ReturnNullOrDieOnFailure::OnBadRequest() (/home/seviezhou/matio/tools/matdump+0x4e9c26)
    #4 0x4257a6 in __asan::asan_malloc(unsigned long, __sanitizer::BufferedStackTrace*) (/home/seviezhou/matio/tools/matdump+0x4257a6)
    #5 0x4da67b in __interceptor_malloc (/home/seviezhou/matio/tools/matdump+0x4da67b)
    #6 0x51e065 in ComplexMalloc /home/seviezhou/matio/src/mat.c:179:28
    #7 0x53b9c2 in Mat_VarRead5 /home/seviezhou/matio/src/mat5.c:3758:32
    #8 0x5c1767 in ReadNextStructField /home/seviezhou/matio/src/mat5.c:1539:39
    #9 0x5bb8de in Mat_VarReadNextInfo5 /home/seviezhou/matio/src/mat5.c:5232:27
    #10 0x522ae1 in Mat_VarReadNextInfo /home/seviezhou/matio/src/mat.c:2418:22
    #11 0x515e15 in main /home/seviezhou/matio/tools/matdump.c:944:31
    #12 0x7f77fb763b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #13 0x41a7e9 in _start (/home/seviezhou/matio/tools/matdump+0x41a7e9)

POC

malloc-size-error-ComplexMalloc-mat-179.zip