ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Thu 
Sep 19 19:43:03 2024 +0200| [ad35eaf848bb605d9b2b3a638265ac9d385878e3] | 
committer: Michael Niedermayer

avcodec/osq: Treat sum = 0 as k = 0

We have no valid sample that triggers this so we do not know if this would 
decode
correctly, but -inf is not the correct k value

Fixes: Assertion n>=0 && n<=32 failed at libavcodec/get_bits.h:423
Fixes: -inf is outside the range of representable values of type 'int'
Fixes: 
70709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6223623839350784

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

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

 libavcodec/osq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/osq.c b/libavcodec/osq.c
index 4e921896c0..2b75364c18 100644
--- a/libavcodec/osq.c
+++ b/libavcodec/osq.c
@@ -160,6 +160,8 @@ static int update_residue_parameter(OSQChannel *cb)
     int rice_k;
 
     sum = cb->sum;
+    if (!sum)
+        return 0;
     x = sum / cb->count;
     rice_k = ceil(log2(x));
     if (rice_k >= 30) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to