Commit e9348e10 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e9d394f3'

* commit 'e9d394f3':
  mlpdec: Do not set invalid context in read_restart_header

Conflicts:
	libavcodec/mlpdec.c

See: a9cd12eeMerged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9d47333e e9d394f3
...@@ -401,10 +401,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, ...@@ -401,10 +401,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
uint8_t checksum; uint8_t checksum;
uint8_t lossless_check; uint8_t lossless_check;
int start_count = get_bits_count(gbp); int start_count = get_bits_count(gbp);
const int max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP int min_channel, max_channel, max_matrix_channel;
const int std_max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
? MAX_MATRIX_CHANNEL_MLP ? MAX_MATRIX_CHANNEL_MLP
: MAX_MATRIX_CHANNEL_TRUEHD; : MAX_MATRIX_CHANNEL_TRUEHD;
int max_channel, min_channel, matrix_channel;
sync_word = get_bits(gbp, 13); sync_word = get_bits(gbp, 13);
...@@ -425,16 +425,16 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, ...@@ -425,16 +425,16 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
min_channel = get_bits(gbp, 4); min_channel = get_bits(gbp, 4);
max_channel = get_bits(gbp, 4); max_channel = get_bits(gbp, 4);
matrix_channel = get_bits(gbp, 4); max_matrix_channel = get_bits(gbp, 4);
if (matrix_channel > max_matrix_channel) { if (max_matrix_channel > std_max_matrix_channel) {
av_log(m->avctx, AV_LOG_ERROR, av_log(m->avctx, AV_LOG_ERROR,
"Max matrix channel cannot be greater than %d.\n", "Max matrix channel cannot be greater than %d.\n",
max_matrix_channel); std_max_matrix_channel);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (max_channel != matrix_channel) { if (max_channel != max_matrix_channel) {
av_log(m->avctx, AV_LOG_ERROR, av_log(m->avctx, AV_LOG_ERROR,
"Max channel must be equal max matrix channel.\n"); "Max channel must be equal max matrix channel.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -458,7 +458,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, ...@@ -458,7 +458,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->min_channel = min_channel; s->min_channel = min_channel;
s->max_channel = max_channel; s->max_channel = max_channel;
s->max_matrix_channel = matrix_channel; s->max_matrix_channel = max_matrix_channel;
#if FF_API_REQUEST_CHANNELS #if FF_API_REQUEST_CHANNELS
if (m->avctx->request_channels > 0 && if (m->avctx->request_channels > 0 &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment