diff options
Diffstat (limited to 'libavcodec/nellymoserdec.c')
-rw-r--r-- | libavcodec/nellymoserdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 278b6b3..cd05482 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -151,17 +151,20 @@ static int decode_tag(AVCodecContext * avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; NellyMoserDecodeContext *s = avctx->priv_data; + int data_max = *data_size; int blocks, i, block_size; int16_t *samples_s16 = data; float *samples_flt = data; + *data_size = 0; block_size = NELLY_SAMPLES * av_get_bytes_per_sample(avctx->sample_fmt); blocks = buf_size / NELLY_BLOCK_LEN; + if (blocks <= 0) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } - if (*data_size < blocks * block_size) { + if (data_max < blocks * block_size) { av_log(avctx, AV_LOG_ERROR, "Output buffer is too small\n"); return AVERROR(EINVAL); } |