mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-29 20:59:00 +00:00
LibGfx: Properly skip color masks in BMP V2+ headers
Color masks should only be used when the compression type is either BITFIELDS or ALPHABITFIELDS. They were always read before and produced corrupted images when there was random data in the mask fields.
This commit is contained in:
parent
c908c14aac
commit
48ca895f5f
Notes:
github-actions[bot]
2025-05-09 19:49:34 +00:00
Author: https://github.com/aplefull
Commit: 48ca895f5f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4660
Reviewed-by: https://github.com/gmta ✅
3 changed files with 15 additions and 0 deletions
|
@ -84,6 +84,16 @@ TEST_CASE(test_bmp_too_many_palette_colors)
|
|||
TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 2, 2 }));
|
||||
}
|
||||
|
||||
TEST_CASE(test_bmp_v4)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("bmp/2x2x32_v4.bmp"sv)));
|
||||
EXPECT(Gfx::BMPImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::BMPImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 2, 2 }));
|
||||
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::Red);
|
||||
}
|
||||
|
||||
TEST_CASE(test_ico_malformed_frame)
|
||||
{
|
||||
Array test_inputs = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue