avformat/wtvdec: clear sectors
authorMichael Niedermayer <[email protected]>
Tue, 6 Aug 2024 22:18:51 +0000 (00:18 +0200)
committerMichael Niedermayer <[email protected]>
Thu, 27 Feb 2025 16:52:52 +0000 (17:52 +0100)
The code can leave uninitialized holes in the array.
Fixes: use of uninitialized values
Fixes: 70883/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6698694567591936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
(cherry picked from commit c95ea0310468e0a0906fa7d590ff7406c39d6991)
Signed-off-by: Michael Niedermayer <[email protected]>
libavformat/wtvdec.c

index cd41ea04edc295a60225cc3676fc41daecf9b12e..cd0a4545af927f5596eb640043f0f1b19473d785 100644 (file)
@@ -182,7 +182,7 @@ static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length,
         int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
         int i;
 
-        wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS);
+        wf->sectors = av_calloc(nb_sectors1, 1 << WTV_SECTOR_BITS);
         if (!wf->sectors) {
             av_free(wf);
             return NULL;