[FFmpeg-devel] [PATCH] speedhq: make sure the block index is not negative

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Mon Jan 30 03:31:08 EET 2017


Fixes out-of-bounds writes.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/speedhq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 385f779f83..6ae1e0f8df 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -198,7 +198,7 @@ static inline int decode_alpha_block(const SHQContext *s, GetBitContext *gb, uin
 
             if (run == 128) break;
             i += run;
-            if (i >= 128)
+            if (i < 0 || i >= 128)
                 return AVERROR_INVALIDDATA;
 
             UPDATE_CACHE_LE(re, gb);
-- 
2.11.0


More information about the ffmpeg-devel mailing list