]> git.sesse.net Git - ffmpeg/commitdiff
tiff: check bppcount
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 19 Feb 2013 16:48:56 +0000 (17:48 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 19 Feb 2013 16:57:36 +0000 (17:57 +0100)
Fixes division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/tiff.c

index 939cfb2dca1e80851dde90033f554742e56e335f..77706c0cda60e70cfbac25afbc66bb7e7c52ddce 100644 (file)
@@ -750,6 +750,11 @@ static int tiff_decode_tag(TiffContext *s)
                    "Samples per pixel requires a single value, many provided\n");
             return AVERROR_INVALIDDATA;
         }
+        if (value > 4U) {
+            av_log(s->avctx, AV_LOG_ERROR,
+                   "Samples per pixel %d is too large\n", value);
+            return AVERROR_INVALIDDATA;
+        }
         if (s->bppcount == 1)
             s->bpp *= value;
         s->bppcount = value;