Headline
CVE-2023-31975: yasm memory leak · Issue #210 · yasm/yasm
yasm v1.3.0 was discovered to contain a memory leak via the function yasm_intnum_copy at /libyasm/intnum.c.
I found a memory leak bug in yasm.
Please confirm.
Thanks!
Test Environment
Ubuntu 20.04, 64 bit yasm (version: v1.3.0 ;master)
How to trigger
Compile the program with AddressSanitizer
Run command
$ touch u
$ ./yasm -ium u
Details
ASAN report
$./yasm -ium u
yasm: file name already has no extension: output will be in `yasm.out'
=================================================================
==973537==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x499c1d in __interceptor_malloc (/home/root/randomFuzz/yasm/yasm/yasm_a_l_e/yasm+0x499c1d)
#1 0x53d0af in def_xmalloc /home/root/FuzzDateset/yasm/yasm-1.3.0/libyasm/xmalloc.c:69:14
#2 0x511025 in yasm_intnum_copy /home/root/FuzzDateset/yasm/yasm-1.3.0/libyasm/intnum.c:397:22
#3 0x638eb4 in group_assign_vstart_recurse /home/root/FuzzDateset/yasm/yasm-1.3.0/modules/objfmts/bin/bin-objfmt.c:424:30
#4 0x632759 in bin_objfmt_output /home/root/FuzzDateset/yasm/yasm-1.3.0/modules/objfmts/bin/bin-objfmt.c:1334:9
#5 0x4d07a2 in do_assemble /home/root/FuzzDateset/yasm/yasm-1.3.0/frontends/yasm/yasm.c:546:5
#6 0x4ccce0 in main /home/root/FuzzDateset/yasm/yasm-1.3.0/frontends/yasm/yasm.c:749:12
#7 0x7f1562a88082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x499c1d in __interceptor_malloc (/home/root/randomFuzz/yasm/yasm/yasm_a_l_e/yasm+0x499c1d)
#1 0x53d0af in def_xmalloc /home/root/FuzzDateset/yasm/yasm-1.3.0/libyasm/xmalloc.c:69:14
#2 0x510522 in yasm_intnum_create_uint /home/root/FuzzDateset/yasm/yasm-1.3.0/libyasm/intnum.c:310:25
#3 0x636694 in bin_lma_create_group /home/root/FuzzDateset/yasm/yasm-1.3.0/modules/objfmts/bin/bin-objfmt.c:248:22
#4 0x51d0f2 in yasm_object_sections_traverse /home/root/FuzzDateset/yasm/yasm-1.3.0/libyasm/section.c:544:22
#5 0x62fb9e in bin_objfmt_output /home/root/FuzzDateset/yasm/yasm-1.3.0/modules/objfmts/bin/bin-objfmt.c:1147:9
#6 0x4d07a2 in do_assemble /home/root/FuzzDateset/yasm/yasm-1.3.0/frontends/yasm/yasm.c:546:5
#7 0x4ccce0 in main /home/root/FuzzDateset/yasm/yasm-1.3.0/frontends/yasm/yasm.c:749:12
#8 0x7f1562a88082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s).