From 179205713a1baa64b3e8415ae2ede17c9b4786d2 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 15 Oct 2016 14:07:37 +0800 Subject: gif: Constrain frames to image boundaries. --- source/fitz/load-gif.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/fitz/load-gif.c b/source/fitz/load-gif.c index 4e71973b..ea1a696a 100644 --- a/source/fitz/load-gif.c +++ b/source/fitz/load-gif.c @@ -216,7 +216,10 @@ gif_read_line(fz_context *ctx, struct info *info, unsigned char *dest, int ct_en unsigned char *mp = &info->mask[index]; unsigned int x, k; - for (x = 0; x < info->image_width; x++, sp++, mp++, dp += 4) + if (info->image_top + y >= info->height) + return; + + for (x = 0; x < info->image_width && info->image_left + x < info->width; x++, sp++, mp++, dp += 4) if (!info->has_transparency || *sp != info->transparent) { *mp = 0x02; -- cgit v1.2.3