[FFmpeg-cvslog] get_bits: change the failure condition in init_get_bits

Luca Barbato git at videolan.org
Mon Mar 10 18:12:01 CET 2014


ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Sun Jan 20 05:10:32 2013 +0100| [a89acaa0b0dbf463a4a60499421e770608a23903] | committer: Luca Barbato

get_bits: change the failure condition in init_get_bits

Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.

Check for NULL buffer instead.

(cherry picked from commit 4603ec85ed620e585fc6e2e072c99858ed421855)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavcodec/get_bits.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index dc348c7..db70937 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -357,7 +357,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
     int buffer_size;
     int ret = 0;
 
-    if (bit_size > INT_MAX - 7 || bit_size <= 0) {
+    if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
         buffer_size = bit_size = 0;
         buffer = NULL;
         ret = AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list