[FFmpeg-cvslog] avcodec: reject audio packets with NULL data and non-zero size
Justin Ruggles
git at videolan.org
Sat Oct 1 21:38:58 CEST 2011
ffmpeg | branch: release/0.8 | Justin Ruggles <justin.ruggles at gmail.com> | Fri Sep 23 21:54:44 2011 -0400| [b8ab1adfcdb1f87e3e26425b4499046352009f29] | committer: Michael Niedermayer
avcodec: reject audio packets with NULL data and non-zero size
There is no valid reason the user should ever send such packets in the
first place, but the documentation for CODEC_CAP_DELAY states that the
codec is guaranteed not to get a NULL packet unless that capability is
set. That isn't true without preventing this case.
(cherry picked from commit 6326afd5e90cfed9df08b652a1cd6f6a948c239a)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8ab1adfcdb1f87e3e26425b4499046352009f29
---
libavcodec/utils.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1aa14a3..ac559d2 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -785,6 +785,11 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
avctx->pkt = avpkt;
+ if (!avpkt->data && avpkt->size) {
+ av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
+ return AVERROR(EINVAL);
+ }
+
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
//FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
More information about the ffmpeg-cvslog
mailing list