From f234b8c129c95857b48a9872506114878a0eaf7d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 13 Nov 2020 11:49:33 +0100 Subject: [PATCH] LibGfx: Add missing stream error handling in GIF frame descriptor parse If we try to read a sentinel byte but the stream is fresh out of data, we have to take care of the stream error and bail out right away, or we'll hit an assertion when exiting the function soon after. Fixes #3486. --- Libraries/LibGfx/GIFLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/LibGfx/GIFLoader.cpp b/Libraries/LibGfx/GIFLoader.cpp index 421b7dbe75..6f9272d607 100644 --- a/Libraries/LibGfx/GIFLoader.cpp +++ b/Libraries/LibGfx/GIFLoader.cpp @@ -446,6 +446,9 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) u8 sentinel = 0; stream >> sentinel; + if (stream.handle_any_error()) + return false; + if (sentinel == 0x21) { u8 extension_type = 0; stream >> extension_type;