[FFmpeg-cvslog] avcodec/ffv1dec_template: Fix signed integer overflow

Michael Niedermayer git at videolan.org
Wed Jul 19 17:59:10 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul 16 02:08:50 2017 +0200| [064d0c64628216b06ff96a0ddea494dfb09b0535] | committer: Michael Niedermayer

avcodec/ffv1dec_template: Fix signed integer overflow

Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 2634/clusterfuzz-testcase-minimized-4540890636877824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 4de4308d2aa3bfaa286ab566caf087d523cf9a85)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=064d0c64628216b06ff96a0ddea494dfb09b0535
---

 libavcodec/ffv1dec_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index 21af155bba..892ccf22fa 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -96,7 +96,7 @@ static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w,
         }
 
         if (sign)
-            diff = -diff;
+            diff = -(unsigned)diff;
 
         sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + diff, bits);
     }



More information about the ffmpeg-cvslog mailing list