Browse code

libopencore_amrwb: check packet size

Fix OOM

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/11/25 02:26:54
Showing 1 changed files
... ...
@@ -359,6 +359,10 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
359 359
                buf_size, packet_size + 1);
360 360
         return AVERROR_INVALIDDATA;
361 361
     }
362
+    if (!packet_size) {
363
+        av_log(avctx, AV_LOG_ERROR, "amr packet_size invalid\n");
364
+        return AVERROR_INVALIDDATA;
365
+    }
362 366
 
363 367
     D_IF_decode(s->state, buf, (short *)s->frame.data[0], _good_frame);
364 368