From 1528a5955b0c1ab8ff07281d67cbc8d6a39ff203 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 15 Oct 2016 15:07:05 +0800 Subject: gif: Do not paste frame data if frame and image do not overlap. --- source/fitz/load-gif.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source') diff --git a/source/fitz/load-gif.c b/source/fitz/load-gif.c index ae937c89..f41dee32 100644 --- a/source/fitz/load-gif.c +++ b/source/fitz/load-gif.c @@ -246,6 +246,13 @@ gif_read_tbid(fz_context *ctx, struct info *info, unsigned char *dest, unsigned mincodesize = *p; + /* if there is no overlap, avoid pasting image data, just consume it */ + if (info->image_top >= info->height || info->image_left >= info->width) + { + p = gif_read_subblocks(ctx, info, p + 1, end, NULL); + return p; + } + fz_var(compressed); fz_var(lzwstm); fz_var(uncompressed); -- cgit v1.2.3