mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
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
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);
|
Streamer streamer(data_ptr, data_remaining);
|
||||||
while (!streamer.at_end()) {
|
while (!streamer.at_end()) {
|
||||||
if (!process_chunk(streamer, context)) {
|
if (!process_chunk(streamer, context)) {
|
||||||
context.state = PNGLoadingContext::State::Error;
|
// Ignore failed chunk and just consider chunk decoding being done.
|
||||||
return false;
|
// decode_png_bitmap() will check whether we got all required ones anyway.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue