qdm2: check array index before use, fix out of array accesses
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 30 Nov 2012 22:59:40 +0000 (23:59 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 30 Nov 2012 23:00:08 +0000 (00:00 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/qdm2.c

index 4cf4b2f..1dfb8d5 100644 (file)
@@ -1257,6 +1257,11 @@ static void qdm2_decode_super_block (QDM2Context *q)
     for (i = 0; packet_bytes > 0; i++) {
         int j;
 
+        if (i>=FF_ARRAY_ELEMS(q->sub_packet_list_A)) {
+            SAMPLES_NEEDED_2("too many packet bytes");
+            return;
+        }
+
         q->sub_packet_list_A[i].next = NULL;
 
         if (i > 0) {