diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-13 02:02:00 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-13 02:02:06 +0100 |
commit | e5949cc12a7af107e4d4265d711fe77278cce5c9 (patch) | |
tree | e07e576ab7c30608d68674172d359c6468d10c88 | |
parent | ff3e8564c440b03dc9cf72f3a7536fe4880ad72e (diff) | |
parent | 684e3d2e1ce96625eeef63f2564aab66f6715d05 (diff) | |
download | ffmpeg-e5949cc12a7af107e4d4265d711fe77278cce5c9.tar.gz |
Merge commit '684e3d2e1ce96625eeef63f2564aab66f6715d05'
* commit '684e3d2e1ce96625eeef63f2564aab66f6715d05':
ra144: check buffer size before requesting a buffer
wmapro: unref skipped frames
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/ra144dec.c | 13 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c index 9cc054cac4..abaf52d449 100644 --- a/libavcodec/ra144dec.c +++ b/libavcodec/ra144dec.c @@ -76,6 +76,13 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data, RA144Context *ractx = avctx->priv_data; GetBitContext gb; + if (buf_size < FRAMESIZE) { + av_log(avctx, AV_LOG_ERROR, + "Frame too small (%d bytes). Truncated file?\n", buf_size); + *got_frame_ptr = 0; + return AVERROR_INVALIDDATA; + } + /* get output buffer */ frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { @@ -84,12 +91,6 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data, } samples = (int16_t *)frame->data[0]; - if(buf_size < FRAMESIZE) { - av_log(avctx, AV_LOG_ERROR, - "Frame too small (%d bytes). Truncated file?\n", buf_size); - *got_frame_ptr = 0; - return buf_size; - } init_get_bits(&gb, buf, FRAMESIZE * 8); for (i = 0; i < LPC_ORDER; i++) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 9a8158f292..d5af3eeb3f 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1399,6 +1399,7 @@ static int decode_frame(WMAProDecodeCtx *s, AVFrame *frame, int *got_frame_ptr) if (s->skip_frame) { s->skip_frame = 0; *got_frame_ptr = 0; + av_frame_unref(frame); } else { *got_frame_ptr = 1; } |