diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-25 17:03:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-25 17:03:40 +0200 |
commit | 9c772a64a1bcbc088208183d8fcb0b8a03b8b708 (patch) | |
tree | 2cf24f9df7b6743affd8892a73e6701dd5a60736 /Libraries/LibGfx/GIFLoader.cpp | |
parent | 838127df35cdfa27d2b6d13bc9a27e535178f7df (diff) | |
download | serenity-9c772a64a1bcbc088208183d8fcb0b8a03b8b708.zip |
LibGfx: Don't proceed with GIF format sniffing if stream read fails
Diffstat (limited to 'Libraries/LibGfx/GIFLoader.cpp')
-rw-r--r-- | Libraries/LibGfx/GIFLoader.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Libraries/LibGfx/GIFLoader.cpp b/Libraries/LibGfx/GIFLoader.cpp index 91497430ee..ad5c0ae42a 100644 --- a/Libraries/LibGfx/GIFLoader.cpp +++ b/Libraries/LibGfx/GIFLoader.cpp @@ -111,6 +111,9 @@ Optional<GIFFormat> decode_gif_header(BufferStream& stream) for (int i = 0; i < 6; ++i) stream >> header[i]; + if (stream.handle_read_failure()) + return {}; + if (!memcmp(header, valid_header_87, sizeof(header))) return GIFFormat::GIF87a; else if (!memcmp(header, valid_header_89, sizeof(header))) |