[FFmpeg-cvslog] roqaudio: Always use the frame buffer on flush

Michael Niedermayer git at videolan.org
Mon Nov 24 13:46:34 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 12 11:13:10 2014 +0100| [55b59fab880a9fcdd30f97c5170af282087ac4f7] | committer: Vittorio Giovara

roqaudio: Always use the frame buffer on flush

Prevent NULL dereference.

CC: libav-stable at libav.org
Bug-Id: CID 703669
Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

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

 libavcodec/roqaudioenc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index f97d5d6..402eb78 100644
--- a/libavcodec/roqaudioenc.c
+++ b/libavcodec/roqaudioenc.c
@@ -147,15 +147,16 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
             context->input_frames++;
             return 0;
         }
-        in = context->frame_buffer;
     }
+    if (context->input_frames < 8)
+        in = context->frame_buffer;
 
     if (stereo) {
         context->lastSample[0] &= 0xFF00;
         context->lastSample[1] &= 0xFF00;
     }
 
-    if (context->input_frames == 7 || !in)
+    if (context->input_frames == 7)
         data_size = avctx->channels * context->buffered_samples;
     else
         data_size = avctx->channels * avctx->frame_size;



More information about the ffmpeg-cvslog mailing list