summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-10-15 14:07:37 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-10-16 12:51:01 +0800
commit179205713a1baa64b3e8415ae2ede17c9b4786d2 (patch)
treeda1f4265ad439614b98269c4c835af76e5ab78e7 /source/fitz
parent6b3af91f1d2349f93ceb77f38a82f640e44c95bc (diff)
downloadmupdf-179205713a1baa64b3e8415ae2ede17c9b4786d2.tar.xz
gif: Constrain frames to image boundaries.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/load-gif.c5
1 files changed, 4 insertions, 1 deletions
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;