Merge commit 'eb9041403d820634c45ed4ee98570246a252507a' into release/2.2
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Mar 2015 12:26:36 +0000 (13:26 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Mar 2015 12:27:22 +0000 (13:27 +0100)
* commit 'eb9041403d820634c45ed4ee98570246a252507a':
  tiff: Check that there is no aliasing in pixel format selection

Conflicts:
libavcodec/tiff.c

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

@@@ -499,14 -270,18 +499,22 @@@ static int init_image(TiffContext *s, T
      int i, ret;
      uint32_t *pal;
  
 -    switch (s->bpp * 10 + s->bppcount) {
+     // 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->planar * 1000 + 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;