[FFmpeg-devel] [PATCH] mjpegenc_huffman: fix uninitialized variable usage

Rostislav Pehlivanov atomnuker at gmail.com
Thu Feb 9 01:19:22 EET 2017


Happened when max_length == 0, in which case i wasn't set to 0 during
the first run. i is supposed to already be at the maximum size when the
max_length is 0.

Fixes CID1400146

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
---
 libavcodec/mjpegenc_huffman.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegenc_huffman.c b/libavcodec/mjpegenc_huffman.c
index a5d7d5365b..075473429c 100644
--- a/libavcodec/mjpegenc_huffman.c
+++ b/libavcodec/mjpegenc_huffman.c
@@ -81,7 +81,7 @@ void ff_mjpegenc_huffman_compute_bits(PTable *prob_table, HuffTable *distincts,
 {
     PackageMergerList list_a, list_b, *to = &list_a, *from = &list_b, *temp;
 
-    int times, i, j, k;
+    int times, i = size, j, k;
 
     int nbits[257] = {0};
 
-- 
2.11.0.483.g087da7b7c



More information about the ffmpeg-devel mailing list