[FFmpeg-cvslog] sgidec: safer check for buffer overflow
Paul B Mahol
git at videolan.org
Sat Aug 10 02:09:40 CEST 2013
ffmpeg | branch: release/2.0 | Paul B Mahol <onemda at gmail.com> | Fri Jul 26 21:53:54 2013 +0000| [80fb38153e7d8c526ee2dce09c0d685bf5220ef1] | committer: Michael Niedermayer
sgidec: safer check for buffer overflow
Signed-off-by: Paul B Mahol <onemda at gmail.com>
(cherry picked from commit 86e722ab97d7f5f0552c8a0958f7910dfcf3c5b7)
Conflicts:
libavcodec/sgidec.c
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80fb38153e7d8c526ee2dce09c0d685bf5220ef1
---
libavcodec/sgidec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index e7f453b..84e39ef 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -58,7 +58,8 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
}
/* Check for buffer overflow. */
- if(out_buf + pixelstride * (count-1) >= out_end) return -1;
+ if (out_end - out_buf <= pixelstride * (count - 1))
+ return -1;
if (pixel & 0x80) {
while (count--) {
More information about the ffmpeg-cvslog
mailing list