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

memory leaks in function cmdopts_parse #332

Closed
xiaoxiaoafeifei opened this issue Jul 20, 2022 · 4 comments · Fixed by #333
Closed

memory leaks in function cmdopts_parse #332

xiaoxiaoafeifei opened this issue Jul 20, 2022 · 4 comments · Fixed by #333

Comments

@xiaoxiaoafeifei
Copy link

xiaoxiaoafeifei commented Jul 20, 2022

Hi,
I found a memory leak bug in function cmdopts_parse on Version 3.0.6

Here's valgrind log:
test@9e5cd2886520:~/fuzz_target/jasper-3.0.6/builder$ valgrind --show-reachable=yes /usr/local/bin/jasper --input test1 --output /dev/null --output-format
==548691== Memcheck, a memory error detector
==548691== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==548691== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==548691== Command: ./src/app/jasper --force-srgb --input /home/zll/out_bk/crashes/test1 --output /dev/null --output-format
==548691==
missing argument for option --output-format
For more information on how to use this command, type:
jasper --help
==548691==
==548691== HEAP SUMMARY:
==548691== in use at exit: 8,336 bytes in 1 blocks
==548691== total heap usage: 1 allocs, 0 frees, 8,336 bytes allocated
==548691==
==548691== LEAK SUMMARY:
==548691== definitely lost: 0 bytes in 0 blocks
==548691== indirectly lost: 0 bytes in 0 blocks
==548691== possibly lost: 0 bytes in 0 blocks
==548691== still reachable: 8,336 bytes in 1 blocks
==548691== suppressed: 0 bytes in 0 blocks

Steps to Reproduce

  1. /usr/local/bin/cmake -DJAS_ENABLE_DOC:BOOL=OFF -B builder
  2. make & make install
  3. valgrind --show-reachable=yes /usr/local/bin/jasper --input input_file --output /dev/null --output-format
    input_file.zip
@jubalh
Copy link
Member

jubalh commented Jul 22, 2022

Can you upload the input file here?

@xiaoxiaoafeifei
Copy link
Author

Can you upload the input file here?

Hi, I have uploaded the input file

@jubalh
Copy link
Member

jubalh commented Jul 25, 2022

Thanks for your report and accompanying PR!

After applying your PR:

valgrind --show-reachable=yes ./src/app/jasper --input ~/Downloads/input_file --output /dev/null --output-format
==13710== Memcheck, a memory error detector
==13710== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==13710== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==13710== Command: ./src/app/jasper --input /home/michael/Downloads/input_file --output /dev/null
==13710== 
==13710== HEAP SUMMARY:
==13710==     in use at exit: 0 bytes in 0 blocks
==13710==   total heap usage: 1 allocs, 1 frees, 8,336 bytes allocated
==13710== 
==13710== All heap blocks were freed -- no leaks are possible
==13710== 
==13710== For lists of detected and suppressed errors, rerun with: -s
==13710== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

@jubalh
Copy link
Member

jubalh commented Sep 16, 2022

Apparently this issue has been assigned CVE-2022-2963.

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 a pull request may close this issue.

2 participants