summaryrefslogtreecommitdiff
path: root/libavcodec/roqaudioenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-12 11:13:10 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-11-24 01:30:15 +0000
commit55b59fab880a9fcdd30f97c5170af282087ac4f7 (patch)
tree9486b62bc723e39e9faa4f51fff0f2f752eeec57 /libavcodec/roqaudioenc.c
parent0562887a984388fdc7a9b71c9374ff9c756fb4f1 (diff)
roqaudio: Always use the frame buffer on flush
Prevent NULL dereference. CC: libav-stable@libav.org Bug-Id: CID 703669 Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/roqaudioenc.c')
-rw-r--r--libavcodec/roqaudioenc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
index f97d5d6e0c..402eb78be5 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;