Message ID | 20201002101849.14935-1-onemda@gmail.com |
---|---|
State | Accepted |
Commit | da5b3d002862d1e105002a6dc1567e6551860896 |
Headers | show |
Series | [FFmpeg-devel] avcodec/tiff: do not abort decoding if strips are available | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Fri, Oct 02, 2020 at 12:18:49PM +0200, Paul B Mahol wrote: > Even if such files are invalid, they can be decoded just fine. > Also stored tiles may have bigger dimensions than displayed ones, > so do not abort decoding in such cases. > > Signed-off-by: Paul B Mahol <onemda@gmail.com> > --- > libavcodec/tiff.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c > index 359d613bb3..9bf08b1900 100644 > --- a/libavcodec/tiff.c > +++ b/libavcodec/tiff.c > @@ -929,8 +929,8 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame, > s->avctx_mjpeg->height == h / 2 && > s->avctx_mjpeg->pix_fmt == AV_PIX_FMT_GRAY16LE) { > is_single_comp = 1; > - } else if (s->avctx_mjpeg->width == w && > - s->avctx_mjpeg->height == h && > + } else if (s->avctx_mjpeg->width >= w && > + s->avctx_mjpeg->height >= h && > s->avctx_mjpeg->pix_fmt == (is_u16 ? AV_PIX_FMT_GRAY16 : AV_PIX_FMT_GRAY8) > ) { > is_single_comp = 0; > @@ -1923,8 +1923,7 @@ again: > has_strip_bits = s->strippos || s->strips || s->stripoff || s->rps || s->sot || s->sstype || s->stripsize || s->stripsizesoff; > > if (has_tile_bits && has_strip_bits) { > - av_log(avctx, AV_LOG_ERROR, "Tiled TIFF is not allowed to strip\n"); > - return AVERROR_INVALIDDATA; > + av_log(avctx, AV_LOG_WARNING, "Tiled TIFF is not allowed to strip\n"); > } > > /* now we have the data and may start decoding */ looks good -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 359d613bb3..9bf08b1900 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -929,8 +929,8 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame, s->avctx_mjpeg->height == h / 2 && s->avctx_mjpeg->pix_fmt == AV_PIX_FMT_GRAY16LE) { is_single_comp = 1; - } else if (s->avctx_mjpeg->width == w && - s->avctx_mjpeg->height == h && + } else if (s->avctx_mjpeg->width >= w && + s->avctx_mjpeg->height >= h && s->avctx_mjpeg->pix_fmt == (is_u16 ? AV_PIX_FMT_GRAY16 : AV_PIX_FMT_GRAY8) ) { is_single_comp = 0; @@ -1923,8 +1923,7 @@ again: has_strip_bits = s->strippos || s->strips || s->stripoff || s->rps || s->sot || s->sstype || s->stripsize || s->stripsizesoff; if (has_tile_bits && has_strip_bits) { - av_log(avctx, AV_LOG_ERROR, "Tiled TIFF is not allowed to strip\n"); - return AVERROR_INVALIDDATA; + av_log(avctx, AV_LOG_WARNING, "Tiled TIFF is not allowed to strip\n"); } /* now we have the data and may start decoding */
Even if such files are invalid, they can be decoded just fine. Also stored tiles may have bigger dimensions than displayed ones, so do not abort decoding in such cases. Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavcodec/tiff.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)