summaryrefslogtreecommitdiff
path: root/src/gif.c
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-06-26 18:04:03 -0400
committerJorge Arellano Cid <jcid@dillo.org>2009-06-26 18:04:03 -0400
commitd56c2d5edcf109ef1544002d8a78e518f71db06c (patch)
tree0ef8d112f988eb9d14a4221e743162e1828a2c59 /src/gif.c
parenteb2a6dc7f2fc0ac7cfb95b0d4f93adb363d6310d (diff)
Image size sanity checks (part 1)
Diffstat (limited to 'src/gif.c')
-rw-r--r--src/gif.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gif.c b/src/gif.c
index 00fbf7eb..4a2bb847 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -814,7 +814,8 @@ static size_t Gif_do_img_desc(DilloGif *gif, void *Buf,
gif->Height = LM_to_uint(buf[6], buf[7]);
/* check max image size */
- if (gif->Width * gif->Height > IMAGE_MAX_W * IMAGE_MAX_H) {
+ if (gif->Width <= 0 || gif->Height <= 0 ||
+ gif->Width > (IMAGE_MAX_W * IMAGE_MAX_H) / gif->Height) {
MSG("Gif_do_img_desc: suspicious image size request %ux%u\n",
gif->Width, gif->Height);
gif->state = 999;