diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2007-03-20 05:44:42 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2007-03-20 05:44:42 +0000 |
commit | b314cfe70991958c1eb302a3f0868a223e67e245 (patch) | |
tree | f0e169c64564730925069fa17aae542d17b6e4cd /libavcodec/wavpack.c | |
parent | b5a05cc29588f305ec1b1dc6598c8a7938825ea7 (diff) | |
download | ffmpeg-b314cfe70991958c1eb302a3f0868a223e67e245.tar.gz |
Correctly handle data_size on decoding
Originally committed as revision 8451 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r-- | libavcodec/wavpack.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index b462174da4..e79d4a570e 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -383,14 +383,20 @@ static int wavpack_decode_frame(AVCodecContext *avctx, uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; - if (buf_size == 0) return 0; + if (buf_size == 0){ + *data_size = 0; + return 0; + } memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); s->samples = AV_RL32(buf); buf += 4; - if(!s->samples) return buf_size; + if(!s->samples){ + *data_size = 0; + return buf_size; + } /* should not happen but who knows */ - if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ + if(s->samples * 2 * avctx->channels > *data_size){ av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -1; } |