Merge commit '5ba83e90919cdeef38e2b5343b48f3f367292564' into release/1.1
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Jun 2013 22:57:23 +0000 (00:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Jun 2013 22:57:23 +0000 (00:57 +0200)
* commit '5ba83e90919cdeef38e2b5343b48f3f367292564':
  wavpack: return meaningful errors

Conflicts:
libavcodec/wavpack.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/wavpack.c

@@@ -787,14 -785,9 +787,14 @@@ static int wavpack_decode_block(AVCodec
      s = wc->fdec[block_no];
      if (!s) {
          av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no);
-         return -1;
+         return AVERROR_INVALIDDATA;
      }
  
 +    if (wc->ch_offset >= avctx->channels) {
 +        av_log(avctx, AV_LOG_ERROR, "too many channels\n");
 +        return -1;
 +    }
 +
      memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
      memset(s->ch, 0, sizeof(s->ch));
      s->extra_bits = 0;
@@@ -1204,10 -1198,10 +1205,10 @@@ static int wavpack_decode_frame(AVCodec
              frame_flags = AV_RL32(buf + 4);
          }
      }
 -    if (s->samples <= 0) {
 +    if (s->samples <= 0 || s->samples > WV_MAX_SAMPLES) {
          av_log(avctx, AV_LOG_ERROR, "Invalid number of samples: %d\n",
                 s->samples);
-         return AVERROR(EINVAL);
+         return AVERROR_INVALIDDATA;
      }
  
      if (frame_flags & 0x80) {