Commit a281f3ca73 for ffmpeg
commit a281f3ca736805f473c69710730d3d61c6314a14
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed Nov 11 17:00:32 2026 +0100
avformat/mov: do not copy an empty index to the IAMF substreams
Fixes: null pointer passed as argument 2, which is declared to never be null
Fixes: DPPYwrys5OTb
Found during the triage of a finding from the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25671
Null pointer argument Replicated through UnModified FFmpeg with UBSAN
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 65f66f6c15..30be8d5b67 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5561,7 +5561,8 @@ static int mov_update_iamf_streams(MOVContext *c, const AVStream *st)
out_sti->index_entries_allocated_size = sti->index_entries_allocated_size;
out_sti->nb_index_entries = sti->nb_index_entries;
out_sti->skip_samples = sti->skip_samples;
- memcpy(out_sti->index_entries, sti->index_entries, sti->index_entries_allocated_size);
+ if (sti->index_entries_allocated_size)
+ memcpy(out_sti->index_entries, sti->index_entries, sti->index_entries_allocated_size);
}
}