summaryrefslogtreecommitdiff
path: root/libavcodec/gifdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-15 10:15:24 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-21 20:52:42 +0100
commitc453723ad7d14abc5e82677eebaa6025fa598f08 (patch)
tree525444bc5c740a60c3b3407cf33fcee054ac9ccd /libavcodec/gifdec.c
parent074c769de93bf12e9f44d77e58a8c7167f9dfb13 (diff)
gifdec: check that the image dimensions are non-zero
Also add an error message an return a more suitable error code (INVALIDDATA, not EINVAL); Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec/gifdec.c')
-rw-r--r--libavcodec/gifdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 136d1127d2..b1207ae19d 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -87,8 +87,11 @@ static int gif_read_image(GifState *s, AVFrame *frame)
/* verify that all the image is inside the screen dimensions */
if (left + width > s->screen_width ||
- top + height > s->screen_height)
- return AVERROR(EINVAL);
+ top + height > s->screen_height ||
+ !width || !height) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid image dimensions.\n");
+ return AVERROR_INVALIDDATA;
+ }
/* build the palette */
n = (1 << bits_per_pixel);