mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 21:35:07 +00:00
LibGfx: Make all image decoders reject image sizes above 16384 pixels
Let's just say no to shenanigans by capping images at 16384 pixels both wide and tall. If a day comes in the future where we need to handle images larger than this, we can deal with it then.
This commit is contained in:
parent
a5f4cb78cf
commit
edf01803cd
7 changed files with 38 additions and 10 deletions
|
@ -853,8 +853,8 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
|
|||
return false;
|
||||
auto& ihdr = *(const PNG_IHDR*)data.data();
|
||||
|
||||
if (ihdr.width > NumericLimits<i32>::max() || ihdr.height > NumericLimits<i32>::max()) {
|
||||
dbgln("PNG has invalid geometry {}x{}", (u32)ihdr.width, (u32)ihdr.height);
|
||||
if (ihdr.width > maximum_width_for_decoded_images || ihdr.height > maximum_height_for_decoded_images) {
|
||||
dbgln("This PNG is too large for comfort: {}x{}", (u32)ihdr.width, (u32)ihdr.height);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue