[FFmpeg-devel] [PATCH] avcodec/tiff: Check for Tiled and Stripped TIFFs
Carl Eugen Hoyos
ceffmpeg at gmail.com
Thu Feb 27 16:10:31 EET 2020
Am Do., 27. Feb. 2020 um 15:05 Uhr schrieb Anton Khirnov <anton at khirnov.net>:
>
> Quoting Michael Niedermayer (2020-02-19 16:49:51)
> > TIFF 6 spec: "Do not use both strip-oriented and tile-oriented fields in the same TIFF file."
> >
> > Fixes: null pointer use, crash
> > Fixes: crash-762680f9d1b27f9b9085e12887ad44893fb2b020
> >
> > Found-by: Shiziru <lunasl at protonmail.com>
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavcodec/tiff.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index e8357114de..fd50b1cbfa 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -1873,6 +1873,12 @@ again:
> > return AVERROR_INVALIDDATA;
> > }
> >
> > + if ( (s->is_tiled || s->tile_byte_counts_offset || s->tile_offsets_offset || s->tile_width || s->tile_length || s->tile_count)
> > + && (s->strippos || s->strips || s->stripoff || s->rps || s->sot || s->sstype || s->stripsize || s->stripsizesoff)) {
>
> This is horribly unreadable. Putting those checks into macros, like
> HAVE_TILES(s) and HAVE_STRIPS(s) would make it a lot better.
Were else in the file could the macros be used?
I fear that adding macros that are only used in one place will make the
code much more unreadable.
Carl Eugen
More information about the ffmpeg-devel
mailing list