summaryrefslogtreecommitdiff
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-11 14:38:21 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-28 11:47:29 -0400
commit9a33264478796fd790a3bdc182fb1dda65d0a9de (patch)
tree93abd9f4179789e941f2418ef03ba99d7e8cb034 /libavcodec/apedec.c
parent0927154d378317be29dd997bda92b305e6dabc00 (diff)
apedec: assert that s->samples is not negative before trying to decode
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8b1af80934..e9069031ad 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;