mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avcodec/exif: skip EXIF entries with invalid TIFF field type 0
EXIF IFD entries with TIFF field type 0 are invalid per the specification. Without a check, exif_read_values() fails to allocate entry->value, causing an out of memory error. This patch skips such entries early during parsing, allowing decoding to continue normally. Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21623
This commit is contained in:
@@ -494,6 +494,11 @@ static int exif_decode_tag(void *logctx, GetByteContext *gb, int le,
|
||||
av_log(logctx, AV_LOG_DEBUG, "TIFF Tag: id: 0x%04x, type: %d, count: %u, offset: %d, "
|
||||
"payload: %" PRIu32 "\n", entry->id, type, count, tell, payload);
|
||||
|
||||
if (!type) {
|
||||
av_log(logctx, AV_LOG_DEBUG, "Skipping invalid TIFF tag 0\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* AV_TIFF_IFD is the largest, numerically */
|
||||
if (type > AV_TIFF_IFD || count >= INT_MAX/8U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
Reference in New Issue
Block a user