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 <lun...@protonmail.com>
Signed-off-by: Michael Niedermayer <mich...@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)) {
+        av_log(avctx, AV_LOG_ERROR, "Tiled TIFF is not allowed to strip\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     /* now we have the data and may start decoding */
     if ((ret = init_image(s, &frame)) < 0)
         return ret;
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to