mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
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>
This commit is contained in:
parent
f4a792fbb9
commit
9a814adf89
@ -1764,7 +1764,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;
|
||||
@ -1829,7 +1829,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);
|
||||
@ -1847,6 +1846,7 @@ again:
|
||||
avpriv_request_sample(s->avctx, "non increasing IFD offset");
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user