avcodec/libtheoraenc: Check for stats allocation failure
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Feb 2015 01:11:27 +0000 (02:11 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Feb 2015 01:11:27 +0000 (02:11 +0100)
Fixes CID1257785

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libtheoraenc.c

index 4c90822..c0074af 100644 (file)
@@ -131,6 +131,10 @@ static int submit_stats(AVCodecContext *avctx)
         }
         h->stats_size = strlen(avctx->stats_in) * 3/4;
         h->stats      = av_malloc(h->stats_size);
+        if (!h->stats) {
+            h->stats_size = 0;
+            return AVERROR(ENOMEM);
+        }
         h->stats_size = av_base64_decode(h->stats, avctx->stats_in, h->stats_size);
     }
     while (h->stats_size - h->stats_offset > 0) {