OSDN Git Service

targa: Fix input buffer size check.
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 26 Mar 2012 22:12:03 +0000 (00:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 26 Mar 2012 22:45:32 +0000 (00:45 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/targa.c

index 5ddd21b..5584195 100644 (file)
@@ -229,7 +229,7 @@ static int decode_frame(AVCodecContext *avctx,
             buf += res;
         }else{
             size_t img_size = s->width * ((s->bpp + 1) >> 3);
-            CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data");
+            CHECK_BUFFER_SIZE(buf, buf_end, img_size * s->height , "image data");
             for(y = 0; y < s->height; y++){
                     memcpy(dst, buf, img_size);