changeset 7819:a16406b793a5 libavcodec

Check output buffer size before decoding.
author vitor
date Sun, 07 Sep 2008 20:21:15 +0000
parents 09291b115695
children 9905b13b3399
files mace.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mace.c	Sun Sep 07 20:18:18 2008 +0000
+++ b/mace.c	Sun Sep 07 20:21:15 2008 +0000
@@ -235,6 +235,11 @@
     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 @@
     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;