summaryrefslogtreecommitdiffstats
path: root/libavcodec/adxdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-04 01:12:34 +0100
commitad1c8dd6734f0aa7a7a87b4669a166715c114b46 (patch)
treec03c08f30bf1a7e8d9859abc48de3391bb05c6a0 /libavcodec/adxdec.c
parentd6da16dca5a64ed7ab2db54710a0c703f179d3ba (diff)
parentfd16f567987524a769d5d4f1f69089f000386ac2 (diff)
downloadffmpeg-streaming-ad1c8dd6734f0aa7a7a87b4669a166715c114b46.zip
ffmpeg-streaming-ad1c8dd6734f0aa7a7a87b4669a166715c114b46.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: fate: add dxtory test adx_parser: rewrite. adxdec: Validate channel count to fix a division by zero. adxdec: Do not require extradata. cmdutils: K&R reformatting cosmetics alacdec: implement the 2-pass prediction type. alacenc: implement the 2-pass prediction type. alacenc: do not generate invalid multi-channel ALAC files alacdec: fill in missing or guessed info about the extradata format. utvideo: proper median prediction for interlaced videos lavu: bump lavu minor for av_popcount64 dca: K&R formatting cosmetics dct: K&R formatting cosmetics lavf: flush decoders in avformat_find_stream_info(). win32: detect number of CPUs using affinity Add av_popcount64 snow: Restore three mistakenly removed casts. Conflicts: cmdutils.c doc/APIchanges libavcodec/adx_parser.c libavcodec/adxdec.c libavcodec/alacenc.c libavutil/avutil.h tests/fate/screen.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/adxdec.c')
-rw-r--r--libavcodec/adxdec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index cf494c1..fdff687 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -45,7 +45,8 @@ static av_cold int adx_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA;
}
- c->channels = avctx->channels;
+ c->channels = avctx->channels;
+ c->header_parsed = 1;
}
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -106,21 +107,21 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
- if(AV_RB16(buf) == 0x8000){
+ if (!c->header_parsed && buf_size >= 2 && AV_RB16(buf) == 0x8000) {
int header_size;
- if ((ret = avpriv_adx_decode_header(avctx, buf,
- buf_size, &header_size,
+ if ((ret = avpriv_adx_decode_header(avctx, buf, buf_size, &header_size,
c->coeff)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error parsing ADX header\n");
return AVERROR_INVALIDDATA;
}
- c->channels = avctx->channels;
- if(buf_size < header_size)
+ c->channels = avctx->channels;
+ c->header_parsed = 1;
+ if (buf_size < header_size)
return AVERROR_INVALIDDATA;
- buf += header_size;
+ buf += header_size;
buf_size -= header_size;
}
- if(c->channels <= 0)
+ if (!c->header_parsed)
return AVERROR_INVALIDDATA;
/* calculate number of blocks in the packet */
OpenPOWER on IntegriCloud