mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibGfx/PNGLoader: Don't allow multiple consecutive IHDR chunks
This commit is contained in:
parent
3250a424f0
commit
bc6ae54b59
Notes:
sideshowbarker
2024-07-17 01:06:10 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/bc6ae54b59 Pull-request: https://github.com/SerenityOS/serenity/pull/21378
1 changed files with 5 additions and 1 deletions
|
@ -1237,8 +1237,12 @@ static ErrorOr<void> process_chunk(Streamer& streamer, PNGLoadingContext& contex
|
|||
}
|
||||
dbgln_if(PNG_DEBUG, "Chunk type: '{}', size: {}, crc: {:x}", chunk_type, chunk_size, chunk_crc);
|
||||
|
||||
if (chunk_type == "IHDR"sv)
|
||||
if (chunk_type == "IHDR"sv) {
|
||||
if (context.state >= PNGLoadingContext::IHDRDecoded)
|
||||
return Error::from_string_literal("Multiple IHDR chunks");
|
||||
|
||||
return process_IHDR(chunk_data, context);
|
||||
}
|
||||
|
||||
if (context.state < PNGLoadingContext::IHDRDecoded)
|
||||
return Error::from_string_literal("IHDR is not the first chunk of the file");
|
||||
|
|
Loading…
Reference in a new issue