Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-15 19:04:12 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-06-10 03:13:11 +0300
commita3d05bf6be2e97092ce2ded0a849d9150aac82f2 (patch)
treeb0e4e35647bc86098da13761aa03095f47264d7f
parent025b38f3a6147aff2f143a930a50b377ad4a60f8 (diff)
avcodec/dcadec: Check scale table index
Fixes CID1297594 part 1 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 0f3e6959bfa67d12cd5a173b86eb15abd7d9e4d5) Conflicts: libavcodec/dcadec.c
-rw-r--r--libavcodec/dcadec.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 801a380df2..f68a6f2982 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1810,23 +1810,34 @@ static int dca_xbr_parse_frame(DCAContext *s)
for(i = 0; i < n_xbr_ch[chset]; i++) {
const uint32_t *scale_table;
int nbits;
+ int scale_table_size;
if (s->scalefactor_huffman[chan_base+i] == 6) {
scale_table = scale_factor_quant7;
+ scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant7);
} else {
scale_table = scale_factor_quant6;
+ scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant6);
}
nbits = anctemp[i];
for(j = 0; j < active_bands[chset][i]; j++) {
if(abits_high[i][j] > 0) {
- scale_table_high[i][j][0] =
- scale_table[get_bits(&s->gb, nbits)];
+ int index = get_bits(&s->gb, nbits);
+ if (index >= scale_table_size) {
+ av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
+ return AVERROR_INVALIDDATA;
+ }
+ scale_table_high[i][j][0] = scale_table[index];
if(xbr_tmode && s->transition_mode[i][j]) {
- scale_table_high[i][j][1] =
- scale_table[get_bits(&s->gb, nbits)];
+ int index = get_bits(&s->gb, nbits);
+ if (index >= scale_table_size) {
+ av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
+ return AVERROR_INVALIDDATA;
+ }
+ scale_table_high[i][j][1] = scale_table[index];
}
}
}