[FFmpeg-cvslog] apedec: assert that s->samples is not negative before trying to decode

Justin Ruggles git at videolan.org
Sat Oct 29 02:31:39 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Oct 11 14:38:21 2011 -0400| [9a33264478796fd790a3bdc182fb1dda65d0a9de] | committer: Justin Ruggles

apedec: assert that s->samples is not negative before trying to decode

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

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8b1af80..e906903 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -26,6 +26,7 @@
 #include "get_bits.h"
 #include "bytestream.h"
 #include "libavutil/audioconvert.h"
+#include "libavutil/avassert.h"
 
 /**
  * @file
@@ -834,6 +835,10 @@ static int ape_decode_frame(AVCodecContext *avctx,
         return AVERROR(EINVAL);
     }
 
+    /* this should never be negative, but bad things will happen if it is, so
+       check it just to make sure. */
+    av_assert0(s->samples >= 0);
+
     if(!s->samples){
         uint32_t offset;
         void *tmp_data;



More information about the ffmpeg-cvslog mailing list