Commit 4b1c19a0 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/matroskadec: Simplify checks for cook and ATRAC3

Some conditions which don't change and which can therefore be checked
in read_header() were instead rechecked upon parsing each block. This
has been changed.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent bdaa98dd
...@@ -2624,7 +2624,8 @@ static int matroska_parse_tracks(AVFormatContext *s) ...@@ -2624,7 +2624,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
track->audio.sub_packet_size = ff_sipr_subpk_size[flavor]; track->audio.sub_packet_size = ff_sipr_subpk_size[flavor];
st->codecpar->bit_rate = sipr_bit_rate[flavor]; st->codecpar->bit_rate = sipr_bit_rate[flavor];
} else if (track->audio.sub_packet_size <= 0) } else if (track->audio.sub_packet_size <= 0 ||
track->audio.frame_size % track->audio.sub_packet_size)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
st->codecpar->block_align = track->audio.sub_packet_size; st->codecpar->block_align = track->audio.sub_packet_size;
extradata_offset = 78; extradata_offset = 78;
...@@ -3138,7 +3139,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska, ...@@ -3138,7 +3139,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
} }
memcpy(track->audio.buf + y * w, data, w); memcpy(track->audio.buf + y * w, data, w);
} else { } else {
if (size < sps * w / sps || h<=0 || w%sps) { if (size < w) {
av_log(matroska->ctx, AV_LOG_ERROR, av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt generic RM-style audio packet size\n"); "Corrupt generic RM-style audio packet size\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
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