[FFmpeg-cvslog] avcodec/g729dec: Avoid using buf_size

Michael Niedermayer git at videolan.org
Sun Dec 1 18:20:07 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Nov  9 21:21:51 2019 +0100| [336f9461df7d2005db9d1af4f5f81fd033025ce2] | committer: Michael Niedermayer

avcodec/g729dec: Avoid using buf_size

buf_size is not updated as buf is advanced so it is wrong after the first
iteration

Fixes: Timeout (160sec -> 27sec)
Fixes: 18658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G729_fuzzer-5729784269373440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/g729dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 70cf3391bd..5257be6e64 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -457,11 +457,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
             buf++;
         }
 
-        for (i = 0; i < buf_size; i++)
+        for (i = 0; i < format->block_size; i++)
             frame_erasure |= buf[i];
         frame_erasure = !frame_erasure;
 
-        init_get_bits(&gb, buf, 8*buf_size);
+        init_get_bits(&gb, buf, 8*format->block_size);
 
         ma_predictor     = get_bits(&gb, 1);
         quantizer_1st    = get_bits(&gb, VQ_1ST_BITS);



More information about the ffmpeg-cvslog mailing list