OSDN Git Service

Prevent 128*1<<trellis from becoming 0 and creating 0 sized arrays.
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2008 11:59:41 +0000 (11:59 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 28 May 2008 11:59:41 +0000 (11:59 +0000)
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

libavcodec/adpcm.c

index d7f76e8..f66274e 100644 (file)
@@ -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 */