[FFmpeg-cvslog] apedec: check bits <= 32.

Michael Niedermayer git at videolan.org
Sun Apr 1 00:58:08 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Mar 29 17:52:21 2012 +0000| [420d1df2e2a857eae45fa947e16eae7494793d57] | committer: Derek Buitenhuis

apedec: check bits <= 32.

Fixes a floating-point exception further down.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

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

 libavcodec/apedec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index a9953e1..1f98267 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -421,9 +421,12 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
 
         if (tmpk <= 16)
             x = range_decode_bits(ctx, tmpk);
-        else {
+        else if (tmpk <= 32) {
             x = range_decode_bits(ctx, 16);
             x |= (range_decode_bits(ctx, tmpk - 16) << 16);
+        } else {
+            av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);
+            return AVERROR_INVALIDDATA;
         }
         x += overflow << tmpk;
     } else {



More information about the ffmpeg-cvslog mailing list