summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-13 11:49:33 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-13 12:01:29 +0100
commitf234b8c129c95857b48a9872506114878a0eaf7d (patch)
treef20189e2b4d411ffd52cc42c2e3c1cec05b0052b /Libraries/LibGfx
parentc0aa455f7621663673b58b9674c493e5ce00371d (diff)
downloadserenity-f234b8c129c95857b48a9872506114878a0eaf7d.zip
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.
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r--Libraries/LibGfx/GIFLoader.cpp3
1 files changed, 3 insertions, 0 deletions
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;