mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/mlpdec: check that streamtype matches the codec
Fixes use of uninitialized memory Fixes msan_uninit-mem_7f126c8ed1ac_5945_issue1731_nonpublic.mpg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
e2742d6ad6
commit
a8d702859b
|
@ -363,10 +363,22 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
|
||||||
* substream is Stereo. Subsequent substreams' layouts are indicated in the
|
* substream is Stereo. Subsequent substreams' layouts are indicated in the
|
||||||
* major sync. */
|
* major sync. */
|
||||||
if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
|
if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
|
||||||
|
if (mh.stream_type != 0xbb) {
|
||||||
|
avpriv_request_sample(m->avctx,
|
||||||
|
"unexpected stream_type %X in MLP",
|
||||||
|
mh.stream_type);
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
if ((substr = (mh.num_substreams > 1)))
|
if ((substr = (mh.num_substreams > 1)))
|
||||||
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
||||||
m->substream[substr].ch_layout = mh.channel_layout_mlp;
|
m->substream[substr].ch_layout = mh.channel_layout_mlp;
|
||||||
} else {
|
} else {
|
||||||
|
if (mh.stream_type != 0xba) {
|
||||||
|
avpriv_request_sample(m->avctx,
|
||||||
|
"unexpected stream_type %X in !MLP",
|
||||||
|
mh.stream_type);
|
||||||
|
return AVERROR_PATCHWELCOME;
|
||||||
|
}
|
||||||
if ((substr = (mh.num_substreams > 1)))
|
if ((substr = (mh.num_substreams > 1)))
|
||||||
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
||||||
if (mh.num_substreams > 2)
|
if (mh.num_substreams > 2)
|
||||||
|
|
Loading…
Reference in New Issue