[FFmpeg-cvslog] sgidec: fix off by 1 error that tested a sample too far for oob.

Michael Niedermayer git at videolan.org
Mon Jul 9 01:36:03 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jul  9 01:31:41 2012 +0200| [7bc155163ec08a0302526d7e19d08c8053f932f0] | committer: Michael Niedermayer

sgidec: fix off by 1 error that tested a sample too far for oob.

This led to decoding failure when linesize was too small.

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

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

 libavcodec/sgidec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 4e8fd31..f11efd0 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -58,7 +58,7 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
         }
 
         /* Check for buffer overflow. */
-        if(out_buf + pixelstride * count >= out_end) return -1;
+        if(out_buf + pixelstride * (count-1) >= out_end) return -1;
 
         if (pixel & 0x80) {
             while (count--) {



More information about the ffmpeg-cvslog mailing list