memory corruption in pic
Bruno Haible via discussion of the GNU roff typesetting system and related software <[email protected]> Sat, 25 Jul 2026 01:19:31 +0200
| Newsgroups | gmane.comp.printing.groff.general |
|---|---|
| Message-ID | <3296089.fxN4lLDhpz@cagnes> |
I tried building the groff-1.25.0.rc1 with clang's ASAN.
The next error (during "make -k check"):
GROFF contrib/mom/examples/slide-demo.pdf
=================================================================
==851776==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x6d23571e0330
#0 0x587f8b4ae9ed in operator delete[](void*) /home/runner/work/llvm-project/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:179:46
#1 0x587f8b4f8b0f in output::~output() /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/object.cpp:47:3
#2 0x587f8b5345a4 in common_output::~common_output() /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/common.h:20:7
#3 0x587f8b53c614 in simple_output::~simple_output() /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/troff.cpp:37:7
#4 0x587f8b53757a in troff_output::~troff_output() /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/troff.cpp:276:1
#5 0x587f8b5375d4 in troff_output::~troff_output() /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/troff.cpp:274:1
#6 0x587f8b4f8423 in main /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/main.cpp:698:3
#7 0x710357e2a600 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:59:16
#8 0x710357e2a717 in __libc_start_main csu/../csu/libc-start.c:360:3
#9 0x587f8b3c5b04 in _start (/build/groff-1.25.0.rc1/build-64-clang/pic+0x80b04)
0x6d23571e0330 is located 0 bytes inside of 7-byte region [0x6d23571e0330,0x6d23571e0337)
allocated by thread T0 here:
#0 0x587f8b46aee4 in malloc /home/runner/work/llvm-project/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3
#1 0x587f8b54c677 in strsave(char const*) /build/groff-1.25.0.rc1/build-64-clang/../src/libs/libgroff/strsave.cpp:36:33
#2 0x587f8b4f8d41 in output::set_args(char const*) /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/object.cpp:62:12
#3 0x587f8b4f7356 in do_picture(_IO_FILE*) /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/main.cpp:297:10
#4 0x587f8b4f5f4f in do_file(char const*) /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/main.cpp:395:2
#5 0x587f8b4f8241 in main /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/main.cpp:691:7
#6 0x710357e2a600 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:59:16
#7 0x710357e2a717 in __libc_start_main csu/../csu/libc-start.c:360:3
#8 0x587f8b3c5b04 in _start (/build/groff-1.25.0.rc1/build-64-clang/pic+0x80b04)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch /build/groff-1.25.0.rc1/build-64-clang/../src/preproc/pic/object.cpp:47:3 in output::~output()
==851776==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==851776==ABORTING
/build/groff-1.25.0.rc1/build-64-clang/groff: error: pic: Aborted
Explanation:
malloc() pairs with free().
new[] pairs with delete[].
Bruno