mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-23 19:49:56 +00:00
avcodec/tiff: Make pixel format checks tighter
Fixes assertion failure with imgsrc001-lzma.tiff Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
b140b51ebb
commit
ab1e431288
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user