[FFmpeg-cvslog] avcodec/jpeglsdec: Fix k=16 in ls_get_code_regular()

Michael Niedermayer git at videolan.org
Sat Feb 20 22:10:40 EET 2021


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jan 30 19:37:52 2021 +0100| [4a4f4cc814f31ad46db847a45dd9b4142bc7b30f] | committer: Michael Niedermayer

avcodec/jpeglsdec: Fix k=16 in ls_get_code_regular()

Fixes: Timeout
Fixes: left shift of 33046 by 16 places cannot be represented in type 'int'
Fixes: 29258/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-4889231489105920
Fixes: 29515/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-6161940391002112

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 980900d991606cbc3747b37d6e83c7aae98cbecc)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 0b1e139048..fd4eb234bc 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -149,7 +149,7 @@ static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
 {
     int k, ret;
 
-    for (k = 0; (state->N[Q] << k) < state->A[Q]; k++)
+    for (k = 0; ((unsigned)state->N[Q] << k) < state->A[Q]; k++)
         ;
 
 #ifdef JLS_BROKEN



More information about the ffmpeg-cvslog mailing list