]> git.sesse.net Git - ffmpeg/commitdiff
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>
Sat, 3 Mar 2012 02:37:52 +0000 (03:37 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/qpeg.c

index ca48b6bcf3422cb2210016e5b1a969d2f50efd97..f2dba732bc42d7cdcc0e9a2bd214f1d0424e717e 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;