Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-12 20:55:09 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-26 17:50:57 +0300
commit900c4ffc487fd639a9353710b7441b6682793284 (patch)
treec5b8fc7dd81b0c982ee5ae8bbe8b40d8a4a48c4d
parent25d79ebbf5443f5215014f6dbf1d3ee1aa895cf7 (diff)
avcodec/tiff: Fix loop detection
Fixes regression with tickets/4364/L1004220.DNG Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 43a4854510a3d596e114d899177a5b3b323ca9fb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index d9fda06672..8a5a81821c 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1786,7 +1786,7 @@ static int decode_frame(AVCodecContext *avctx,
TiffContext *const s = avctx->priv_data;
AVFrame *const p = data;
ThreadFrame frame = { .f = data };
- unsigned off, last_off;
+ unsigned off, last_off = 0;
int le, ret, plane, planes;
int i, j, entries, stride;
unsigned soff, ssize;
@@ -1851,7 +1851,6 @@ again:
/** whether we should process this multi-page IFD's next page */
retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed
- last_off = off;
if (retry_for_page) {
// set offset to the next IFD
off = ff_tget_long(&s->gb, le);
@@ -1869,6 +1868,7 @@ again:
avpriv_request_sample(s->avctx, "non increasing IFD offset\n");
return AVERROR_INVALIDDATA;
}
+ last_off = off;
if (off >= UINT_MAX - 14 || avpkt->size < off + 14) {
av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
return AVERROR_INVALIDDATA;