summaryrefslogtreecommitdiff
path: root/libavcodec/mace.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-09-07 20:21:15 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-09-07 20:21:15 +0000
commit42fe17a0187051fb9f981a067f31a78c185841a6 (patch)
tree467a0a8c02a8367e697bcc00e0e05b3b884a4dea /libavcodec/mace.c
parentd636f0cc397fed8eb27daed896abab8972041baf (diff)
Check output buffer size before decoding.
Originally committed as revision 15257 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mace.c')
-rw-r--r--libavcodec/mace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/mace.c b/libavcodec/mace.c
index 6e7a12812b..8651744726 100644
--- a/libavcodec/mace.c
+++ b/libavcodec/mace.c
@@ -235,6 +235,11 @@ static int mace3_decode_frame(AVCodecContext *avctx,
MACEContext *ctx = avctx->priv_data;
int i, j, k;
+ if (*data_size < 2 * 3 * buf_size) {
+ av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
+ return -1;
+ }
+
for(i = 0; i < avctx->channels; i++) {
int16_t *output = samples + i;
@@ -266,6 +271,11 @@ static int mace6_decode_frame(AVCodecContext *avctx,
MACEContext *ctx = avctx->priv_data;
int i, j;
+ if (*data_size < 2 * 6 * buf_size) {
+ av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
+ return -1;
+ }
+
for(i = 0; i < avctx->channels; i++) {
int16_t *output = samples + i;