[FFmpeg-cvslog] sgidec: safer check for buffer overflow

Paul B Mahol git at videolan.org
Sat Jul 27 14:05:35 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jul 26 21:53:54 2013 +0000| [86e722ab97d7f5f0552c8a0958f7910dfcf3c5b7] | committer: Paul B Mahol

sgidec: safer check for buffer overflow

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

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

diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index a32620b..4f7f8ac 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 - 1) >= out_end)
+        if (out_end - out_buf <= pixelstride * (count - 1))
             return AVERROR_INVALIDDATA;
 
         if (pixel & 0x80) {



More information about the ffmpeg-cvslog mailing list