Browse Source

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.
Nico Weber 4 years ago
parent
commit
1f22a59f9d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Libraries/LibGfx/GIFLoader.cpp

+ 2 - 0
Libraries/LibGfx/GIFLoader.cpp

@@ -569,6 +569,8 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
             }
             }
 
 
             stream >> image.lzw_min_code_size;
             stream >> image.lzw_min_code_size;
+            if (stream.handle_any_error())
+                return false;
 
 
             u8 lzw_encoded_bytes_expected = 0;
             u8 lzw_encoded_bytes_expected = 0;