diff mbox series

[FFmpeg-devel,1/2] avformat/mov: Don't zero twice

Message ID AS8P250MB0744CFCDE952A8197DAE249C8F5A2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,1/2] avformat/mov: Don't zero twice | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 26, 2024, 9:45 p.m. UTC
Redundant since eee3b7e2fb0664b889e58c03f76e19ef23e4d1d8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mov.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

James Almer Feb. 26, 2024, 9:50 p.m. UTC | #1
On 2/26/2024 6:45 PM, Andreas Rheinhardt wrote:
> Redundant since eee3b7e2fb0664b889e58c03f76e19ef23e4d1d8.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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.
diff mbox series

Patch

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;
 }