Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory leak in file zbarimg/zbarimg.c #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xiaoxiaoafeifei
Copy link

@xiaoxiaoafeifei xiaoxiaoafeifei commented Oct 21, 2024

Reproduction:

  1. export CFLAGS="-g -O0 -fsanitize=address" CXXFLAGS="-g -O0 -fsanitize=address"
    export CC=afl-gcc CXX=afl-g++
  2. zbarimg poc
    poc_file:
    poc.zip

LeakSanitizer result:
==4387==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2168 byte(s) in 1 object(s) allocated from:
#0 0x7f8ffb014302 in __interceptor_malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:75
#1 0x7f8ffb6d0086 in NewMagickWand (/lib/libGraphicsMagickWand-Q16.so.2+0x20086)
#2 0x56305e2bdd07 in main zbarimg/zbarimg.c:448
#3 0x7f8ff9a29d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)

Indirect leak of 8536 byte(s) in 1 object(s) allocated from:
#0 0x7f8ffb014302 in __interceptor_malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:75
#1 0x7f8ffa69d627 in CloneImageInfo (/lib/libGraphicsMagick-Q16.so.3+0x9d627)
#2 0x56305e2bdd07 in main zbarimg/zbarimg.c:448
#3 0x7f8ff9a29d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)

Indirect leak of 256 byte(s) in 1 object(s) allocated from:
#0 0x7f8ffb014302 in __interceptor_malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:75
#1 0x7f8ffa6ee847 in CloneString (/lib/libGraphicsMagick-Q16.so.3+0xee847)

Indirect leak of 133 byte(s) in 4 object(s) allocated from:
#0 0x7f8ffb014302 in __interceptor_malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:75
#1 0x7f8ffa6e9fc0 in AcquireString (/lib/libGraphicsMagick-Q16.so.3+0xe9fc0)

Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f8ffb014302 in __interceptor_malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:75
#1 0x7f8ffa6bf187 in CloneQuantizeInfo (/lib/libGraphicsMagick-Q16.so.3+0xbf187)
#2 0x56305e2bdd07 in main zbarimg/zbarimg.c:448
#3 0x7f8ff9a29d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)

SUMMARY: LeakSanitizer: 11125 byte(s) leaked in 8 allocation(s).

@xiaoxiaoafeifei xiaoxiaoafeifei changed the title fix potential memory leak in file zbarimg/zbarimg.c fix memory leak in file zbarimg/zbarimg.c Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant