LibGfx: Don't proceed with GIF format sniffing if stream read fails

This commit is contained in:
Andreas Kling 2020-04-25 17:03:40 +02:00
parent 838127df35
commit 9c772a64a1
Notes: sideshowbarker 2024-07-19 07:18:12 +09:00

View file

@ -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)))