[FFmpeg-cvslog] Merge commit '9f732e4c996243c1e57c2bbbec6c8b94c37a7a22'

Hendrik Leppkes git at videolan.org
Mon Nov 14 13:35:17 EET 2016


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Mon Nov 14 12:30:35 2016 +0100| [bebab21176c1f052f748cfb2384cc01e0bdb13f4] | committer: Hendrik Leppkes

Merge commit '9f732e4c996243c1e57c2bbbec6c8b94c37a7a22'

* commit '9f732e4c996243c1e57c2bbbec6c8b94c37a7a22':
  tiffenc: Check av_pix_fmt_desc_get() return value

Merged-by: Hendrik Leppkes <h.leppkes at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bebab21176c1f052f748cfb2384cc01e0bdb13f4
---

 libavcodec/tiffenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 3d37d2e..e575c4c 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -265,6 +265,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     s->subsampling[0] = 1;
     s->subsampling[1] = 1;
 
+    if (!desc)
+        return AVERROR(EINVAL);
+
     avctx->bits_per_coded_sample =
     s->bpp          = av_get_bits_per_pixel(desc);
     s->bpp_tab_size = desc->nb_components;


======================================================================

diff --cc libavcodec/tiffenc.c
index 3d37d2e,24312f0..e575c4c
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@@ -265,32 -246,37 +265,35 @@@ static int encode_frame(AVCodecContext 
      s->subsampling[0] = 1;
      s->subsampling[1] = 1;
  
++    if (!desc)
++        return AVERROR(EINVAL);
++
 +    avctx->bits_per_coded_sample =
 +    s->bpp          = av_get_bits_per_pixel(desc);
 +    s->bpp_tab_size = desc->nb_components;
 +
      switch (avctx->pix_fmt) {
      case AV_PIX_FMT_RGBA64LE:
 -    case AV_PIX_FMT_RGB48LE:
 -    case AV_PIX_FMT_GRAY16LE:
      case AV_PIX_FMT_RGBA:
 +        alpha = 1;
 +    case AV_PIX_FMT_RGB48LE:
      case AV_PIX_FMT_RGB24:
 -    case AV_PIX_FMT_GRAY8:
 -    case AV_PIX_FMT_PAL8:
 -        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;
 -        else if (pfd->flags & AV_PIX_FMT_FLAG_RGB)
 -            s->photometric_interpretation = TIFF_PHOTOMETRIC_RGB;
 -        else
 -            s->photometric_interpretation = TIFF_PHOTOMETRIC_BLACK_IS_ZERO;
 -        s->bpp_tab_size = pfd->nb_components;
 -        for (i = 0; i < s->bpp_tab_size; i++)
 -            bpp_tab[i] = s->bpp / s->bpp_tab_size;
 +        s->photometric_interpretation = TIFF_PHOTOMETRIC_RGB;
          break;
 +    case AV_PIX_FMT_GRAY8:
 +        avctx->bits_per_coded_sample = 0x28;
 +    case AV_PIX_FMT_GRAY8A:
 +    case AV_PIX_FMT_YA16LE:
 +        alpha = avctx->pix_fmt == AV_PIX_FMT_GRAY8A || avctx->pix_fmt == AV_PIX_FMT_YA16LE;
 +    case AV_PIX_FMT_GRAY16LE:
      case AV_PIX_FMT_MONOBLACK:
 -        s->bpp                        = 1;
          s->photometric_interpretation = TIFF_PHOTOMETRIC_BLACK_IS_ZERO;
 -        s->bpp_tab_size               = 0;
 +        break;
 +    case AV_PIX_FMT_PAL8:
 +        s->photometric_interpretation = TIFF_PHOTOMETRIC_PALETTE;
          break;
      case AV_PIX_FMT_MONOWHITE:
 -        s->bpp                        = 1;
          s->photometric_interpretation = TIFF_PHOTOMETRIC_WHITE_IS_ZERO;
 -        s->bpp_tab_size               = 0;
          break;
      case AV_PIX_FMT_YUV420P:
      case AV_PIX_FMT_YUV422P:



More information about the ffmpeg-cvslog mailing list