diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-19 21:08:34 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-19 21:09:07 +0200 |
commit | f0c0ae37c66913c8a26ab25718c22f105dd28b82 (patch) | |
tree | 8671500600f987eefed6de848f69a17e582e1958 /libavcodec/tiff.c | |
parent | 6ea69a8ffaeabf1a8bfd0c7db1019ca5ac082c99 (diff) | |
download | ffmpeg-f0c0ae37c66913c8a26ab25718c22f105dd28b82.tar.gz |
avcodec/tiff: Check that pix_fmt is a yuv variant for TIFF_PHOTOMETRIC_YCBCR
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r-- | libavcodec/tiff.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 61387e7320..d5c03e8f01 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -643,6 +643,15 @@ static int init_image(TiffContext *s, ThreadFrame *frame) s->bpp, s->bppcount); return AVERROR_INVALIDDATA; } + + if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); + if((desc->flags & AV_PIX_FMT_FLAG_RGB) || desc->nb_components < 3) { + av_log(s->avctx, AV_LOG_ERROR, "Unsupported YCbCr variant\n"); + return AVERROR_INVALIDDATA; + } + } + if (s->width != s->avctx->width || s->height != s->avctx->height) { ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) |