[FFmpeg-cvslog] get_bits: check the number of bits parameter through av_assert2()

Michael Niedermayer git at videolan.org
Sat Apr 7 20:57:11 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Apr  7 16:04:09 2012 +0200| [6560fa390e9a296276faaa22779936f187f05a96] | committer: Michael Niedermayer

get_bits: check the number of bits parameter through av_assert2()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/get_bits.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 09b846e..2123972 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -30,6 +30,7 @@
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
+#include "libavutil/avassert.h"
 #include "mathops.h"
 
 /*
@@ -222,6 +223,7 @@ static inline int get_sbits(GetBitContext *s, int n)
 {
     register int tmp;
     OPEN_READER(re, s);
+    av_assert2(n>0 && n<=25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_SBITS(re, s, n);
     LAST_SKIP_BITS(re, s, n);
@@ -236,6 +238,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
 {
     register int tmp;
     OPEN_READER(re, s);
+    av_assert2(n>0 && n<=25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_UBITS(re, s, n);
     LAST_SKIP_BITS(re, s, n);
@@ -250,6 +253,7 @@ static inline unsigned int show_bits(GetBitContext *s, int n)
 {
     register int tmp;
     OPEN_READER(re, s);
+    av_assert2(n>0 && n<=25);
     UPDATE_CACHE(re, s);
     tmp = SHOW_UBITS(re, s, n);
     return tmp;



More information about the ffmpeg-cvslog mailing list