[FFmpeg-devel] [PATCH 3/3] avcodec/get_bits: add assertion to limit ouptut value of get_bits

Marton Balint cus at passwd.hu
Sun Feb 17 21:44:53 EET 2019


Should fix the following Coverity false positives:

Coverity CID #1415651.
Coverity CID #1420392.
Coverity CID #1420473.
Coverity CID #1433770.
Coverity CID #1435320.
Coverity CID #1439573.
Coverity CID #1439580.
Coverity CID #1439588.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavcodec/get_bits.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 2e2adc29c2..c2f267186e 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -403,6 +403,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
     LAST_SKIP_BITS(re, s, n);
     CLOSE_READER(re, s);
 #endif
+    av_assert2(tmp < UINT64_C(1) << n);
     return tmp;
 }
 
-- 
2.16.4



More information about the ffmpeg-devel mailing list