]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/flashsv2enc: Fix use of uninitialized value
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 27 Jan 2021 11:24:33 +0000 (12:24 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 28 Jan 2021 12:59:00 +0000 (13:59 +0100)
Before 257a83b969157eb76c18158a4e503e908d8b1125, certain buffers were
zero-allocated in the init function and only reallocated lateron if they
turned out to be too small; now they are only allocated during init,
leading to use-of-uninitialized values lateron. The same could happen
before if the dimensions are big enough so that the buffers would be
reallocated, as the new part of the reallocated buffer would not be
zeroed (happened for 960x960). So always zero the buffers in the
function designed to init them.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/flashsv2enc.c

index 5139b17a2856c2725a12f0f050870d7f1ac70d6e..430b6806c8828bc2e891592b94d73c867322e500 100644 (file)
@@ -142,6 +142,7 @@ static void init_blocks(FlashSV2Context * s, Block * blocks,
 {
     int row, col;
     Block *b;
+    memset(blocks, 0, s->cols * s->rows * sizeof(*blocks));
     for (col = 0; col < s->cols; col++) {
         for (row = 0; row < s->rows; row++) {
             b = blocks + (col + row * s->cols);