Mercurial > libavcodec.hg
changeset 7242:d90bc6cc1bfd libavcodec
Check that we have enough output space available.
author | michael |
---|---|
date | Fri, 11 Jul 2008 19:45:52 +0000 |
parents | 239031d20617 |
children | 158c8bc08f81 |
files | wmadec.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/wmadec.c Fri Jul 11 15:25:12 2008 +0000 +++ b/wmadec.c Fri Jul 11 19:45:52 2008 +0000 @@ -781,6 +781,11 @@ skip_bits(&s->gb, 4); /* super frame index */ nb_frames = get_bits(&s->gb, 4) - 1; + if((nb_frames+1) * s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){ + av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n"); + goto fail; + } + bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3); if (s->last_superframe_len > 0) { @@ -836,6 +841,10 @@ s->last_superframe_len = len; memcpy(s->last_superframe, buf + pos, len); } else { + if(s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){ + av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n"); + goto fail; + } /* single frame decode */ if (wma_decode_frame(s, samples) < 0) goto fail;