The get_bits api assumes it can always read at least a byte during
UPDATE_CACHE.
---

It isn't wonderful but is safer and quicker than trying to check the
return value around the codebase. (There are plenty of samples that
segfault)

 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 5a0089a..a8cd64b 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -380,7 +380,7 @@ static inline int init_get_bits(GetBitContext *s, const 
uint8_t *buffer,

     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
         buffer_size = bit_size = 0;
-        buffer      = NULL;
+        buffer      = (uint8_t *)s;
         ret         = AVERROR_INVALIDDATA;
     }

--
1.8.1.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to