aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/sgidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-27 20:48:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-01 13:28:14 +0100
commit73c6520c096b017e0a464718fee683abae4c5d2c (patch)
tree4d34c3d375b5eb4703caf91c94c6b047c8993575 /libavcodec/sgidec.c
parentca47574e16ca6988ad7eda56d65e1d7b4fc35878 (diff)
downloadffmpeg-73c6520c096b017e0a464718fee683abae4c5d2c.tar.gz
avcodec/sgidec: fix count check
Fixes: asan_heap-oob_22b30d4_39_038.sgi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit a050cf0c451bdf1c1bd512c4fce6b6f8a5e85102) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sgidec.c')
-rw-r--r--libavcodec/sgidec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 8338863637..3ddbf77bc8 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -98,7 +98,7 @@ static int expand_rle_row16(SgiState *s, uint16_t *out_buf,
break;
/* Check for buffer overflow. */
- if (pixelstride * (count - 1) >= len) {
+ if (out_end - out_buf <= pixelstride * (count - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n");
return AVERROR_INVALIDDATA;
}