ffmpeg | branch: release/2.8 | Michael Niedermayer <mich...@niedermayer.cc> | 
Fri Jul  5 02:21:46 2024 +0200| [416d92d900e40fd63dcbdfb1a55e96068600b06a] | 
committer: Michael Niedermayer

avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()

Found by code review related to CID1604563 Overflowed return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit b2aaeb81f65aaa61238d74a77034b118055340d3)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

 libavcodec/golomb.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index c37e6c408b..428a2ae36c 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -280,6 +280,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, 
int limit,
     log = av_log2(buf);
 
     if (log > 31 - limit) {
+        av_assert2(log >= k);
         buf >>= log - k;
         buf  += (30U - log) << k;
         LAST_SKIP_BITS(re, gb, 32 + k - log);

_______________________________________________
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