diff mbox series

[FFmpeg-devel,v2,1/2] Revert "avformat/mov: zero initialize the index ranges buffer"

Message ID AS8P250MB0744E3373BEE03FF338F6F078F5A2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 9d7d03ea4598484e2d200976d0064df41186a630
Headers show
Series [FFmpeg-devel,v2,1/2] Revert "avformat/mov: zero initialize the index ranges buffer" | 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, 10:11 p.m. UTC
This reverts commit eee3b7e2fb0664b889e58c03f76e19ef23e4d1d8.
It has been made in an attempt to fix UBSan test failures with
GCC 13 (see e.g. [1]), but it did not help at all. So revert it,
but use av_malloc_array() instead of going back to av_malloc().

[1]: https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-ubsan&time=20240226182430

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index effa46120f..71e8f7ae8f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4031,7 +4031,8 @@  static void mov_fix_index(MOVContext *mov, AVStream *st)
     }
 
     // allocate the index ranges array
-    msc->index_ranges = av_calloc((msc->elst_count + 1), sizeof(msc->index_ranges[0]));
+    msc->index_ranges = av_malloc_array(msc->elst_count + 1,
+                                        sizeof(msc->index_ranges[0]));
     if (!msc->index_ranges) {
         av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
         return;