changeset 9577:0b4ee8aa4c11 libavcodec

Check if there is enough bytes before reading the buffer in the EA ADPCM decoder. Fix issue 990.
author vitor
date Mon, 27 Apr 2009 16:06:01 +0000
parents 7a9f0be3ad64
children 14b9819158a8
files adpcm.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/adpcm.c	Mon Apr 27 16:04:43 2009 +0000
+++ b/adpcm.c	Mon Apr 27 16:06:01 2009 +0000
@@ -1209,11 +1209,11 @@
         }
         break;
     case CODEC_ID_ADPCM_EA:
-        samples_in_chunk = AV_RL32(src);
-        if (samples_in_chunk >= ((buf_size - 12) * 2)) {
+        if (buf_size < 4 || AV_RL32(src) >= ((buf_size - 12) * 2)) {
             src += buf_size;
             break;
         }
+        samples_in_chunk = AV_RL32(src);
         src += 4;
         current_left_sample   = (int16_t)bytestream_get_le16(&src);
         previous_left_sample  = (int16_t)bytestream_get_le16(&src);