When running timg under the "-g60x59 --center -b 'blue' --fit-width --clear -ph --auto-crop=15" configuration options, we found two memory leaks in the function main at /src/timg.cc:541:30 and /src/timg.cc:961:35.
=================================================================
==2978288==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 5 byte(s) in 1 object(s) allocated from:
#0 0x487e04 in strdup (/afltest/timg/src/timg+0x487e04)
#1 0x4d08a2 in main /afltest/timg/src/timg.cc:541:30
#2 0x7ffff7587082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: 5 byte(s) leaked in 1 allocation(s).
Memory leaks on timg
Description
When running timg under the "-g60x59 --center -b 'blue' --fit-width --clear -ph --auto-crop=15" configuration options, we found two memory leaks in the function main at /src/timg.cc:541:30 and /src/timg.cc:961:35.
Command1
ASAN Log1
cd timg
./src/timg -g60x59 --center -b 'blue' --fit-width --clear -ph --auto-crop=15 id\:000000\,sig\:06\,src\:001731\,time\:1596515\,execs\:39195\,op\:havoc\,rep\:3
Location1
main /afltest/timg/src/timg.cc:541:30
PoC1:
https://github.com/Frank-Z7/z-vulnerabilitys/blob/main/id_000000%2Csig_06%2Csrc_001731%2Ctime_1596515%2Cexecs_39195%2Cop_havoc%2Crep_3
Command2
ASAN Log2
cd timg
./src/timg -g60x59 --center -b 'blue' --fit-width --clear -ph --auto-crop=15 poc2timg
Location2
PoC2:
https://github.com/Frank-Z7/z-vulnerabilitys/blob/main/poc2timg
Version
Reference
https://github.com/hzeller/timg
Actual Behavior
Memory leaks
Environment
Thanks for your time!
Credit
Zeng Yunxiang
Song Jiaxuan