diff --git a/libavcodec/exif.c b/libavcodec/exif.c index 0f3f80c976..a980da2a7b 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -78,6 +78,11 @@ static int exif_decode_tag(AVCodecContext *avctx, GetByteContext *gbytes, int le ff_tread_tag(gbytes, le, &id, &type, &count, &cur_pos); + if (!bytestream2_tell(gbytes)) { + bytestream2_seek(gbytes, cur_pos, SEEK_SET); + return 0; + } + // read count values and add it metadata // store metadata or proceed with next IFD ret = ff_tis_ifd(id);