summaryrefslogtreecommitdiff
path: root/libavcodec/wnv1.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-20 00:07:34 +0300
committerMartin Storsjö <martin@martin.st>2013-09-22 16:10:21 +0300
commit91be1103fd1f79d381edf268c32f4166b6c3b6d8 (patch)
treee2a44acb23a093d2bd7aa40413ba30644830ffa9 /libavcodec/wnv1.c
parentf1eac2b8a0370b908cd691086d11f51342054730 (diff)
wnv1: Make sure the input packet is large enough
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/wnv1.c')
-rw-r--r--libavcodec/wnv1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index 418c5f76ab..13a875e584 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -70,6 +70,11 @@ static int decode_frame(AVCodecContext *avctx,
int prev_y = 0, prev_u = 0, prev_v = 0;
uint8_t *rbuf;
+ if (buf_size < 8) {
+ av_log(avctx, AV_LOG_ERROR, "Packet is too short\n");
+ return AVERROR_INVALIDDATA;
+ }
+
rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!rbuf) {
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");