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

A flaw of memory leak #49

Closed
phplaber opened this issue Aug 19, 2022 · 1 comment
Closed

A flaw of memory leak #49

phplaber opened this issue Aug 19, 2022 · 1 comment

Comments

@phplaber
Copy link

phplaber commented Aug 19, 2022

this bug was found with afl.

proof:

=================================================================
==26325==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 7499 byte(s) in 1 object(s) allocated from:
#0 0x7f7716c54cef in operator new[](unsigned long) ../../../../libsanitizer/asan/asan_new_delete.cc:107
#1 0x54f41b in cimg_library::CImg::CImg(unsigned int, unsigned int, unsigned int, unsigned int) CImg/CImg.h:11793
#2 0x54f41b in cimg_library::CImg::_load_jpeg(_IO_FILE*, char const*) CImg/CImg.h:51847
#3 0x58272f in cimg_library::CImg::load_jpeg(char const*) CImg/CImg.h:51771
#4 0x58272f in cimg_library::CImg::load(char const*) CImg/CImg.h:51419
#5 0x41d800 in cimg_library::CImg::assign(char const*) CImg/CImg.h:12578
#6 0x41d800 in load_image src/load_image.cc:49
#7 0x40f7e3 in print_iterate src/print_image.c:95
#8 0x40f7e3 in print_image src/print_image.c:77

SUMMARY: AddressSanitizer: 7499 byte(s) leaked in 1 allocation(s).

[NAME OF AFFECTED PRODUCT(S) AND VERSION(S)]
CImg v2.9.3

[PROBLEM TYPE]
memory leak, cause program crash.

[DESCRIPTION]
The problem arises when using the CImg::load_jpeg function

jpeg sample file:

memory_leak_sample

@eddieantonio
Copy link
Owner

Thanks for bringing this to my attention. This is a flaw in the upstream CImg (see: https://github.com/GreycLab/CImg). I have upgraded to the latest version, but even then, a memory leak is not a big deal in imgcat, since it only opens one (or a few) images, then immediately exits. As such, I am marking this as wontfix.

@eddieantonio eddieantonio closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants