1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibGfx: Recognize incomplete BMP colormaps

This commit is contained in:
Ben Wiederhake 2020-09-03 21:35:50 +02:00 committed by Andreas Kling
parent a4b207e04f
commit 031814796e

View file

@ -861,8 +861,12 @@ static bool decode_bmp_color_table(BMPLoadingContext& context)
Streamer streamer(context.data + bmp_header_size + context.dib_size(), size_of_color_table);
for (u32 i = 0; !streamer.at_end() && i < max_colors; ++i) {
if (bytes_per_color == 4) {
if (!streamer.has_u32())
return false;
context.color_table.append(streamer.read_u32());
} else {
if (!streamer.has_u24())
return false;
context.color_table.append(streamer.read_u24());
}
}