[FFmpeg-cvslog] avcodec/flashsv2enc: Fix use of uninitialized value

Andreas Rheinhardt git at videolan.org
Thu Jan 28 15:32:56 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Jan 27 12:24:33 2021 +0100| [9267e2ff0d5b518bcce6236d09f2941b2c1bba84] | committer: Andreas Rheinhardt

avcodec/flashsv2enc: Fix use of uninitialized value

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 at passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9267e2ff0d5b518bcce6236d09f2941b2c1bba84
---

 libavcodec/flashsv2enc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c
index 5139b17a28..430b6806c8 100644
--- a/libavcodec/flashsv2enc.c
+++ b/libavcodec/flashsv2enc.c
@@ -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);



More information about the ffmpeg-cvslog mailing list