[FFmpeg-cvslog] mpegvideo: fix out of heap array accesses

Michael Niedermayer git at videolan.org
Sat Jun 9 21:05:17 CEST 2012


ffmpeg | branch: release/0.10 | Michael Niedermayer <michaelni at gmx.at> | Wed Jun  6 19:26:21 2012 +0200| [997e7692d83ad8c2ce4d5abaf26e9f1e2e68b53b] | committer: Michael Niedermayer

mpegvideo: fix out of heap array accesses

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 317ca0d3f735fad354c404e8bbac3e1ce9f09b12)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=997e7692d83ad8c2ce4d5abaf26e9f1e2e68b53b
---

 libavcodec/mpegvideo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 16803a0..3e90178 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1429,7 +1429,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
             y  = (x * f) >> 16;
             fr = (x * f) & 0xFFFF;
             buf[y * stride + x]       += (color * (0x10000 - fr)) >> 16;
-            buf[(y + 1) * stride + x] += (color *            fr ) >> 16;
+            if(fr) buf[(y + 1) * stride + x] += (color *            fr ) >> 16;
         }
     } else {
         if (sy > ey) {
@@ -1446,7 +1446,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
             x  = (y*f) >> 16;
             fr = (y*f) & 0xFFFF;
             buf[y * stride + x]     += (color * (0x10000 - fr)) >> 16;
-            buf[y * stride + x + 1] += (color *            fr ) >> 16;
+            if(fr) buf[y * stride + x + 1] += (color *            fr ) >> 16;
         }
     }
 }



More information about the ffmpeg-cvslog mailing list