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
Fl_Shared_Image: use of unitialized data on invalid input #216
Comments
Good finding. Looking at the code below that point it seems that the
Then run pixmap_browser with valgrind and open x.jpg.
The same for all following comparisons, and the image handler calls in line 273 |
FTR: I'm working on a fix and some more related documentations. It's almost ready and will likely be committed and pushed soon. @fire-eggs Kevin, your proposed fix is included and extended as written above. |
- fix issue as proposed - fix more potential access to uninitialized data issues - document Fl_Shared_Image::add_handler() - document typedef Fl_Shared_Image::Fl_Shared_Handler()
@fire-eggs Kevin, please test and confirm that commit f9e8ef0 fixes the issue. It's a much larger fix because I had to dig deeper to find even more issues in FLTK's image check functions. I also improved documentation (see commit log). |
Definitely much improved!
When I make time, I'll look over the various changes, but as far as this particular issue is concerned, it is FIXED. I'll have to make more bugs in my code ;-} |
@fire-eggs Thanks for the confirmation (two months ago), I must have missed this. Closing the issue now. |
FLTK 1.4.x, 202110409 snapshot.
Linux Mint 20.1 MATE
Running Valgrind on a program derived from pixmap_browser.cxx. Due to a bug in my code, I am occasionally passing a folder path to
Fl_Shared_Image::get()
. Valgrind gives me the following error [earlier stack elided]:The problem is not at the line shown above, but in this following chunk of code [lines 258-263]:
In the case of a folder path, the
fread()
call to populateheader
returns 0, andheader
has not been initialized. The code proceeds to useheader
in an invalid state.I suggest something like this instead:
I've tried the above change and Valgrind no longer complains about uninitialized values.
The text was updated successfully, but these errors were encountered: