From 7bc155163ec08a0302526d7e19d08c8053f932f0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 Jul 2012 01:31:41 +0200 Subject: [PATCH] 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 --- libavcodec/sgidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 4e8fd31ef1..f11efd05ee 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--) {