qpeg: Fix out of array writes.
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 3 Mar 2012 02:37:52 +0000 (03:37 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Mar 2012 05:29:10 +0000 (06:29 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/qpeg.c

index bbb9f71..adbeff0 100644 (file)
@@ -203,6 +203,8 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
                     filled = 0;
                     dst -= stride;
                     height--;
+                    if(height < 0)
+                        break;
                 }
             }
         } else if(code >= 0xC0) { /* copy code: 0xC0..0xDF */
@@ -214,6 +216,8 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
                     filled = 0;
                     dst -= stride;
                     height--;
+                    if(height < 0)
+                        break;
                 }
             }
             size -= code + 1;