-
Notifications
You must be signed in to change notification settings - Fork 264
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 248 #251
Conversation
@cmb69 Please review, if you have a tad bit time. |
for (i = 0; i < encoded_pixels; i++) { | ||
for (j = 0; j < pixel_block_size; j++, bitmap_caret++) { | ||
tga->bitmap[ bitmap_caret ] = decompression_buffer[ buffer_caret + j ]; | ||
if (encoded_pixels > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encoded_pixels
is declared as uint8_t
, so this would always be true. Either the if statement is useless, or it should be encoded_pixels < 128
. Same issue below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it won't be always true, but it could be changed to if (encoded_pixels != 0)
for clarity. (It might also be an useless optimization as encoded_pixels
would be always != 0
in normal case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it won't be always true, […]
Of course! Sorry for the noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to != 0
anyway to make more clear (although I suspect any decent compiler would do that for me anyway).
4e952ed
to
388ee78
Compare
While I assumed that bug00248.tga is corrupt, both Gimp and Imagick's display open it without warning (contrary to bug00247.tga). Not sure, if Gimp and Imagick do advanced error correction here. |
fixes output buffer overflow in #248