[FFmpeg-cvslog] avcodec/mss2: Check for repeat overflow
Michael Niedermayer
git at videolan.org
Fri Jan 15 17:51:12 CET 2016
ffmpeg | branch: release/2.5 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jan 10 12:19:48 2016 +0100| [4c6b48a08e5a975fba644e7eafa1ce5ee35ac618] | committer: Michael Niedermayer
avcodec/mss2: Check for repeat overflow
Fixes: mss2_left_shift.wmv
Found-by: Piotr Bandurski <ami_stuff at o2.pl>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit e273dade78943e22b71d0ddb67cd0d737fc26edf)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c6b48a08e5a975fba644e7eafa1ce5ee35ac618
---
libavcodec/mss2.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 4d53f8a..ea448da 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -209,8 +209,13 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
last_symbol = b << 8 | bytestream2_get_byte(gB);
else if (b > 129) {
repeat = 0;
- while (b-- > 130)
+ while (b-- > 130) {
+ if (repeat >= (INT_MAX >> 8) - 1) {
+ av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
+ return AVERROR_INVALIDDATA;
+ }
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
+ }
if (last_symbol == -2) {
int skip = FFMIN((unsigned)repeat, dst + w - p);
repeat -= skip;
More information about the ffmpeg-cvslog
mailing list