tiffenc: Check av_pix_fmt_desc_get() return value
authorVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 27 Jun 2016 00:08:55 +0000 (20:08 -0400)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 29 Jun 2016 19:25:42 +0000 (15:25 -0400)
libavcodec/tiffenc.c

index 7c23ee2..24312f0 100644 (file)
@@ -254,7 +254,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     case AV_PIX_FMT_RGB24:
     case AV_PIX_FMT_GRAY8:
     case AV_PIX_FMT_PAL8:
-        pfd    = av_pix_fmt_desc_get(avctx->pix_fmt);
+        pfd = av_pix_fmt_desc_get(avctx->pix_fmt);
+        if (!pfd)
+            return AVERROR_BUG;
         s->bpp = av_get_bits_per_pixel(pfd);
         if (pfd->flags & AV_PIX_FMT_FLAG_PAL)
             s->photometric_interpretation = TIFF_PHOTOMETRIC_PALETTE;