aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-10 15:47:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-10 16:00:57 +0200
commit2e6338b47276bf66fc470a44e8c23a8e57daf07f (patch)
tree31774db1582156b13a096b1449a1b08238d3ca65 /libavcodec
parentbc95b9428950cd672162bcb2bb98fbecad52a5b3 (diff)
parent4ecdb5ed44591aba8a0ddb7d443cace836f761f6 (diff)
downloadffmpeg-2e6338b47276bf66fc470a44e8c23a8e57daf07f.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: qdm2: Conceal broken samples See: 5ee008e01d5a50d976b5f2a4abd6932185672d91 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/qdm2.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index b9529e7701..921f322c4a 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -532,8 +532,8 @@ static void build_sb_samples_from_noise(QDM2Context *q, int sb)
* @param channels number of channels
* @param coding_method q->coding_method[0][0][0]
*/
-static void fix_coding_method_array(int sb, int channels,
- sb_int8_array coding_method)
+static int fix_coding_method_array(int sb, int channels,
+ sb_int8_array coding_method)
{
int j, k;
int ch;
@@ -541,6 +541,8 @@ static void fix_coding_method_array(int sb, int channels,
for (ch = 0; ch < channels; ch++) {
for (j = 0; j < 64; ) {
+ if (coding_method[ch][sb][j] < 8)
+ return -1;
if ((coding_method[ch][sb][j] - 8) > 22) {
run = 1;
case_val = 8;
@@ -586,6 +588,7 @@ static void fix_coding_method_array(int sb, int channels,
j += run;
}
}
+ return 0;
}
/**
@@ -844,16 +847,16 @@ static int synthfilt_build_sb_samples(QDM2Context *q, GetBitContext *gb,
for (j = 0; j < 16; j++)
sign_bits[j] = get_bits1 (gb);
- if (q->coding_method[0][sb][0] <= 0) {
- av_log(NULL, AV_LOG_ERROR, "coding method invalid\n");
- return AVERROR_INVALIDDATA;
- }
-
for (j = 0; j < 64; j++)
if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
q->coding_method[0][sb][j] = q->coding_method[1][sb][j];
- fix_coding_method_array(sb, q->nb_channels, q->coding_method);
+ if (fix_coding_method_array(sb, q->nb_channels,
+ q->coding_method)) {
+ av_log(NULL, AV_LOG_ERROR, "coding method invalid\n");
+ build_sb_samples_from_noise(q, sb);
+ continue;
+ }
channels = 1;
}