This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2cddfe7d0c101ed30edafb5d4ef8c0efde61559b Author: Leo Izen <[email protected]> AuthorDate: Sat Apr 4 11:15:26 2026 -0400 Commit: Leo Izen <[email protected]> CommitDate: Fri May 1 07:40:24 2026 -0400 avcodec/exif.c: pop entry off IFD if allocation fails In av_exif_set_entry, if cloning the entry fails because of an alloc failed, then we remove the entry from the IFD. If that entry exists in the middle of ifd->entries we need to shift everything to the left which this commit implements. Signed-off-by: Leo Izen <[email protected]> --- libavcodec/exif.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavcodec/exif.c b/libavcodec/exif.c index 6b29ce4cbd..8c2e41b764 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -1196,7 +1196,7 @@ int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTif uint32_t count, const uint8_t *ifd_lead, uint32_t ifd_offset, const void *value) { void *temp; - int ret = 0; + int ret, offset; AVExifEntry *entry = NULL; AVExifEntry src = { 0 }; @@ -1208,6 +1208,7 @@ int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTif ret = av_exif_get_entry(logctx, ifd, id, 0, &entry); if (ret < 0) return ret; + offset = ret; if (entry) { exif_free_entry(entry); @@ -1235,8 +1236,15 @@ int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, enum AVTif ret = exif_clone_entry(entry, &src); - if (ret < 0) + if (ret < 0) { + /* offset is the actual offset + 1 */ + if (offset) { + size_t remaining = ifd->count - offset; + /* pop the entry off the IFD by shifting everything to the left */ + memmove(&ifd->entries[offset - 1], &ifd->entries[offset], sizeof(*ifd->entries) * remaining); + } ifd->count--; + } return ret; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
