summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-26 10:44:11 +0200
committerAnton Khirnov <anton@khirnov.net>2013-05-28 08:03:37 +0200
commitd1bec4be2207738669874e02605e879ea9620974 (patch)
treea0a9255e34fd3e2bcb8af4e8f77f253627fb4144 /libavcodec/wavpack.c
parent1d177200ce1ffd8902729e3a4d647b04fc4b35f8 (diff)
wavpack: return an error on 0-sized blocks
Such blocks are not valid.
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 2afc1edeea..d673ad454c 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -765,11 +765,6 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
int i, j, id, size, ssize, weights, t;
int bpp, chan, chmask, orig_bpp;
- if (buf_size == 0) {
- *got_frame_ptr = 0;
- return 0;
- }
-
if (block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n");
return AVERROR_INVALIDDATA;
@@ -1212,7 +1207,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
frame_size = AV_RL32(buf + 8) + 12;
}
}
- if (frame_size < 0 || frame_size > buf_size) {
+ if (frame_size <= 0 || frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR,
"Block %d has invalid size (size %d vs. %d bytes left)\n",
s->block, frame_size, buf_size);