summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-24 01:54:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-24 01:55:19 +0200
commitab1e4312887d8e560d027803871b55b883910714 (patch)
tree46ff98cfeafe973aa5e29c8dff5ec64a92e584cf /libavcodec
parentb140b51ebbc277fa558accc33f3e99da2b9657b3 (diff)
avcodec/tiff: Make pixel format checks tighter
Fixes assertion failure with imgsrc001-lzma.tiff Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/tiff.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 613ad3d9e0..1e2d23514a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -490,7 +490,9 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
const uint8_t *ssrc = src;
int width = ((s->width * s->bpp) + 7) >> 3;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(p->format);
- int is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) && desc->nb_components >= 2;
+ int is_yuv = !(desc->flags & AV_PIX_FMT_FLAG_RGB) &&
+ (desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
+ desc->nb_components >= 3;
if (s->planar)
width /= s->bppcount;
@@ -723,7 +725,9 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
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) {
+ if((desc->flags & AV_PIX_FMT_FLAG_RGB) ||
+ !(desc->flags & AV_PIX_FMT_FLAG_PLANAR) ||
+ desc->nb_components < 3) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported YCbCr variant\n");
return AVERROR_INVALIDDATA;
}