]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/get_bits: add assertion to limit ouptut value of get_bits
authorMarton Balint <cus@passwd.hu>
Sat, 16 Feb 2019 23:21:09 +0000 (00:21 +0100)
committerMarton Balint <cus@passwd.hu>
Fri, 1 Mar 2019 21:33:58 +0000 (22:33 +0100)
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@passwd.hu>
libavcodec/get_bits.h

index 2e2adc29c26dc077c269a17485f5ec275e1c9a2b..c2f267186e3e8641388706d86b9b8c1369c608a2 100644 (file)
@@ -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;
 }