aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-15 01:21:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-15 01:27:10 +0100
commit67235dfa1d2b4bab2c8015e5b8e43ea63a681892 (patch)
tree6de0622de5bbdf40c5770899bcfb989b31bcd2a4 /libavcodec/adpcm.c
parent9e2ee46206a5a4db91ee4d26737b515797e6b08e (diff)
parente0febda22d0e0fab094a9c886b0e0f0f662df1ef (diff)
downloadffmpeg-67235dfa1d2b4bab2c8015e5b8e43ea63a681892.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: h264: stricter reference limit enforcement. h264: increase reference poc list from 16 to 32. xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns. snow: check reference frame indices. snow: reject unsupported chroma shifts. Add ffvhuff encoding and decoding regression test anm: convert to bytestream2 API bytestream: add more unchecked variants for bytestream2 API jvdec: unbreak video decoding jv demux: set video stream duration fate: add pam image regression test Conflicts: libavcodec/adpcm.c libavcodec/anm.c libavcodec/h264.c libavcodec/mpegvideo.h libavcodec/snowdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 559eb293ce..dec23a37e4 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -265,8 +265,9 @@ static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned c
return c->predictor;
}
-static void xa_decode(short *out, const unsigned char *in,
- ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
+static int xa_decode(AVCodecContext *avctx,
+ short *out, const unsigned char *in,
+ ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
{
int i, j;
int shift,filter,f0,f1;
@@ -278,7 +279,7 @@ static void xa_decode(short *out, const unsigned char *in,
shift = 12 - (in[4+i*2] & 15);
filter = in[4+i*2] >> 4;
if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
- av_log_ask_for_sample(NULL, "unknown filter %d\n", filter);
+ av_log_ask_for_sample(avctx, "unknown XA-ADPCM filter %d\n", filter);
filter=0;
}
f0 = xa_adpcm_table[filter][0];
@@ -309,7 +310,7 @@ static void xa_decode(short *out, const unsigned char *in,
shift = 12 - (in[5+i*2] & 15);
filter = in[5+i*2] >> 4;
if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) {
- av_log_ask_for_sample(NULL, "unknown filter %d\n", filter);
+ av_log_ask_for_sample(avctx, "unknown XA-ADPCM filter %d\n", filter);
filter=0;
}
@@ -336,6 +337,8 @@ static void xa_decode(short *out, const unsigned char *in,
left->sample2 = s_2;
}
}
+
+ return 0;
}
/**
@@ -823,8 +826,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
break;
case CODEC_ID_ADPCM_XA:
while (buf_size >= 128) {
- xa_decode(samples, src, &c->status[0], &c->status[1],
- avctx->channels);
+ if ((ret = xa_decode(avctx, samples, src, &c->status[0],
+ &c->status[1], avctx->channels)) < 0)
+ return ret;
src += 128;
samples += 28 * 8;
buf_size -= 128;