From 86e722ab97d7f5f0552c8a0958f7910dfcf3c5b7 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 26 Jul 2013 21:53:54 +0000 Subject: [PATCH] sgidec: safer check for buffer overflow Signed-off-by: Paul B Mahol --- libavcodec/sgidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index a32620be78..4f7f8ac9f1 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) {