From e37000b1ea8350fe24b18cdd5acc17b567b668cc Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 15 Mar 2023 13:34:31 +0100 Subject: [PATCH] LibGfx: Let decode_bmp_v5_dib() skip reserved field This has no effect in practice: decode_bmp_v5_dib() is the last thing called with the streamer object (...the streamer is passed to set_dib_bitmasks(), but that doesn't read anything off it except for DIBType::Info bitmaps, which v5 bitmaps aren't). But dib_size is 16 larger for v5 than for v4, so we should read 16 bytes. This is also useful for a hypothetical person who might look at the reading code to figure out how the writing code should look like. --- Userland/Libraries/LibGfx/BMPLoader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index 7abfffad81..bae791c339 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -805,6 +805,7 @@ static bool decode_bmp_v5_dib(BMPLoadingContext& context, InputStreamer& streame v5.intent = streamer.read_u32(); v5.profile_data = streamer.read_u32(); v5.profile_size = streamer.read_u32(); + streamer.drop_bytes(4); // Ignore reserved field. if constexpr (BMP_DEBUG) { dbgln("BMP intent: {}", v5.intent);