summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-05-28 11:59:41 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-05-28 11:59:41 +0000
commit909a9ad08df0132c8945c010c3aca3a409c06935 (patch)
tree5d1479276e287d8994bdd2ceef2afbbac210ed76
parente5f6b7e5ace89fd328cb44713afc8741b0c72771 (diff)
Prevent 128*1<<trellis from becoming 0 and creating 0 sized arrays.
fixes CID84 RUN2 CID85 RUN2 CID86 RUN2 CID87 RUN2 CID88 RUN2 CID89 RUN2 CID90 RUN2 CID91 RUN2 CID92 RUN2 CID93 RUN2 CID94 RUN2 CID95 RUN2 CID96 RUN2 CID97 RUN2 CID98 RUN2 CID99 RUN2 CID100 RUN2 CID101 RUN2 CID102 RUN2 CID103 RUN2 CID104 RUN2 CID105 RUN2 CID106 RUN2 Originally committed as revision 13495 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/adpcm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index d7f76e80a9..f66274e829 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -158,6 +158,12 @@ static int adpcm_encode_init(AVCodecContext *avctx)
{
if (avctx->channels > 2)
return -1; /* only stereo or mono =) */
+
+ if(avctx->trellis && (unsigned)avctx->trellis > 16U){
+ av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
+ return -1;
+ }
+
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_WAV:
avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */