[FFmpeg-devel] [PATCH 1/2] avformat/mov: Don't zero twice
James Almer
jamrial at gmail.com
Mon Feb 26 23:50:22 EET 2024
On 2/26/2024 6:45 PM, Andreas Rheinhardt wrote:
> Redundant since eee3b7e2fb0664b889e58c03f76e19ef23e4d1d8.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> libavformat/mov.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index effa46120f..d81e34d100 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4287,10 +4287,6 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
> av_free(ctts_data_old);
> av_freep(&frame_duration_buffer);
>
> - // Null terminate the index ranges array
> - current_index_range++;
> - current_index_range->start = 0;
> - current_index_range->end = 0;
> msc->current_index = msc->index_ranges[0].start;
> }
If zeroing the buffer proved to not be beneficial, then maybe it's best
to revert said commit (or replace av_calloc with av_malloc_array to keep
the integer overflow checks).
It will prevent writing to the same memory twice, and allow us to detect
unintended access to uninitialized bytes.
Either way lgtm.
More information about the ffmpeg-devel
mailing list