From 1f22a59f9d0f442eec37f8dab9ee4f6577c00caf Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 29 Nov 2020 14:04:14 -0500 Subject: [PATCH] LibGfx: Don't assert on files ending right before lzw_min_code_size Not yet found by oss-fuzz, but I hit it a while ago when running FuzzGIFLoader locally. --- Libraries/LibGfx/GIFLoader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibGfx/GIFLoader.cpp b/Libraries/LibGfx/GIFLoader.cpp index 63feed39c82..0fc1c42ff89 100644 --- a/Libraries/LibGfx/GIFLoader.cpp +++ b/Libraries/LibGfx/GIFLoader.cpp @@ -569,6 +569,8 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) } stream >> image.lzw_min_code_size; + if (stream.handle_any_error()) + return false; u8 lzw_encoded_bytes_expected = 0;