From 34b6f1efa20694eab6268197e788a3c1a5cb2a3b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 24 Nov 2012 18:26:54 +0100 Subject: [PATCH] libopencore_amrwb: check packet size Fix OOM Signed-off-by: Michael Niedermayer --- libavcodec/libopencore-amr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index efe87cd0fa..f0207aed8d 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -359,6 +359,10 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, buf_size, packet_size + 1); return AVERROR_INVALIDDATA; } + if (!packet_size) { + av_log(avctx, AV_LOG_ERROR, "amr packet_size invalid\n"); + return AVERROR_INVALIDDATA; + } D_IF_decode(s->state, buf, (short *)s->frame.data[0], _good_frame);