mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-02 20:35:37 +02:00
matroskadec: validate audio channels and bitdepth
In the TTA extradata re-construction the values are written with avio_wl16 and if they don't fit into uint16_t, this triggers an av_assert2 in avio_w8. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
5b76c82fd7
commit
92e79a2f7b
@ -1889,6 +1889,18 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
|||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
avio_write(&b, "TTA1", 4);
|
avio_write(&b, "TTA1", 4);
|
||||||
avio_wl16(&b, 1);
|
avio_wl16(&b, 1);
|
||||||
|
if (track->audio.channels > UINT16_MAX ||
|
||||||
|
track->audio.bitdepth > UINT16_MAX) {
|
||||||
|
av_log(matroska->ctx, AV_LOG_WARNING,
|
||||||
|
"Too large audio channel number %"PRIu64
|
||||||
|
" or bitdepth %"PRIu64". Skipping track.\n",
|
||||||
|
track->audio.channels, track->audio.bitdepth);
|
||||||
|
av_freep(&extradata);
|
||||||
|
if (matroska->ctx->error_recognition & AV_EF_EXPLODE)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
avio_wl16(&b, track->audio.channels);
|
avio_wl16(&b, track->audio.channels);
|
||||||
avio_wl16(&b, track->audio.bitdepth);
|
avio_wl16(&b, track->audio.bitdepth);
|
||||||
if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX)
|
if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user