ladybird/Tests/LibGfx
sideshowbarker 8e2eee7654 LibGfx: Reject undersized backing storage when creating bitmaps
Problem: A borked ImageDecoder could send a BitmapSequence over IPC with
metadata for a (large) bitmap while shipping a too-small backing buffer.
Decoding it produced a Gfx::Bitmap that reported the (large) geometry
but pointed at the too-small buffer — making the first write go OOB.

Cause: BitmapSequence decode reads size_in_bytes and the bitmap geometry
as independent fields, and only checked if size_in_bytes matched the
transferred buffer size — never that either is consistent with the
geometry. The single-frame fast path then handed the buffer to
Bitmap::create_with_anonymous_buffer with no verification.

Fix: Make the two bitmap factories that take externally-provided storage
enforce that it covers the geometry. create_with_anonymous_buffer now
fails with buffers smaller than the minimum expected size_in_bytes — and
create_with_raw_data similarly rejects data too small for the geometry.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/10036
2026-06-19 13:43:07 +02:00
..
test-inputs LibGfx: Reject a BMP V5 ICC profile offset that points out of bounds 2026-06-15 20:19:33 +09:00
BenchmarkJPEGLoader.cpp Everywhere: Remove Serenity specific code from tests 2024-07-05 07:29:51 +02:00
CMakeLists.txt LibGfx: Reject undersized backing storage when creating bitmaps 2026-06-19 13:43:07 +02:00
TestBitmapExport.cpp LibGfx: Move bitmap export out of ImmutableBitmap 2026-05-05 14:39:17 -05:00
TestBitmapSequence.cpp LibGfx: Reject undersized backing storage when creating bitmaps 2026-06-19 13:43:07 +02:00
TestColor.cpp LibGfx: Implement WCAG's contrast ratio in Color 2026-06-09 17:23:26 +02:00
TestImageDecoder.cpp LibGfx: Reject a BMP V5 ICC profile offset that points out of bounds 2026-06-15 20:19:33 +09:00
TestImageWriter.cpp LibGfx: Remove WebP animation writer and utility 2025-08-05 11:30:20 +02:00
TestQuad.cpp LibGfx: Verify Rect and Quad are consistent in boundary point inclusions 2024-12-15 23:27:42 +01:00
TestRect.cpp LibGfx+LibWeb: Delete unused Line class and Rect methods 2025-11-04 23:16:02 +01:00
TestShareableBitmap.cpp LibGfx: Reject the Invalid bitmap format from IPC decoders 2026-06-19 10:33:36 +02:00
TestWOFF.cpp LibGfx: Rename WOFF[2]::try_load_from_externally_owned_memory() 2025-05-03 12:01:43 +01:00
TestWOFF2.cpp Meta: Enforce newlines around namespaces 2025-05-14 02:01:59 -06:00
TestYUVData.cpp LibGfx: Preserve native YUV samples for CPU conversion 2026-05-05 14:39:17 -05:00