[FFmpeg-cvslog] aacdec_usac: prevent get_bits(0) in get_escaped_value

Lynne git at videolan.org
Tue Jun 4 04:07:29 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sun Jun  2 23:27:50 2024 +0200| [208dd9fdea32175736e294d2de6602d4d44b97f6] | committer: Lynne

aacdec_usac: prevent get_bits(0) in get_escaped_value

Some calls to get_escaped_value() specify 0 bits as the third value.
This would result in get_bits(0), which is not a correct usage of the
get_bits API.

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

 libavcodec/aac/aacdec_usac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index c76d72d7a7..19390ad794 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -38,7 +38,7 @@ static inline uint32_t get_escaped_value(GetBitContext *gb, int nb1, int nb2, in
         return val;
 
     val += val2 = get_bits(gb, nb2);
-    if (val2 == ((1 << nb2) - 1))
+    if (nb3 && (val2 == ((1 << nb2) - 1)))
         val += get_bits(gb, nb3);
 
     return val;



More information about the ffmpeg-cvslog mailing list