Merge commit '62b0462e5fa78901380ca229ddb6a7625efd61a2' into release/1.1
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 10 Mar 2015 13:13:30 +0000 (14:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 10 Mar 2015 13:13:35 +0000 (14:13 +0100)
* commit '62b0462e5fa78901380ca229ddb6a7625efd61a2':
  tiff: Check that there is no aliasing in pixel format selection

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/tiff.c

@@@ -605,14 -236,18 +605,22 @@@ static int init_image(TiffContext *s
      int i, ret;
      uint32_t *pal;
  
+     // make sure there is no aliasing in the following switch
+     if (s->bpp >= 100 || s->bppcount >= 10) {
+         av_log(s->avctx, AV_LOG_ERROR,
+                "Unsupported image parameters: bpp=%d, bppcount=%d\n",
+                s->bpp, s->bppcount);
+         return AVERROR_INVALIDDATA;
+     }
      switch (s->bpp * 10 + s->bppcount) {
      case 11:
 -        s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
 -        break;
 +        if (!s->palette_is_set) {
 +            s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
 +            break;
 +        }
 +    case 21:
 +    case 41:
      case 81:
          s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
          break;