LibGfx: Let PNGLoader handle failed chunk decoding gracefully
decode_png_chunks() is not handling "critical" chunks, unlike decode_png_size() for example. When we encounter a chunk decoding failure, e.g. because not enough bytes were left to read, just continue with decoding the bitmap - which will fail on its own, if we're missing some required chunk(s). Fixes #4984.
This commit is contained in:
parent
6d20b54b09
commit
95988b44a0
Notes:
sideshowbarker
2024-07-18 23:09:05 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/95988b44a0f Pull-request: https://github.com/SerenityOS/serenity/pull/4985 Issue: https://github.com/SerenityOS/serenity/issues/4984
1 changed files with 3 additions and 2 deletions
|
@ -592,8 +592,9 @@ static bool decode_png_chunks(PNGLoadingContext& context)
|
|||
Streamer streamer(data_ptr, data_remaining);
|
||||
while (!streamer.at_end()) {
|
||||
if (!process_chunk(streamer, context)) {
|
||||
context.state = PNGLoadingContext::State::Error;
|
||||
return false;
|
||||
// Ignore failed chunk and just consider chunk decoding being done.
|
||||
// decode_png_bitmap() will check whether we got all required ones anyway.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue