1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '75647dea6f7db79b409bad66a119f5c73da730f3'

* commit '75647dea6f7db79b409bad66a119f5c73da730f3':
  oggparseogm: check timing variables

See: 9ed388f598
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-01-06 15:24:42 +01:00
commit 59725592a9

View File

@ -79,6 +79,11 @@ ogm_header(AVFormatContext *s, int idx)
size = FFMIN(size, os->psize); size = FFMIN(size, os->psize);
time_unit = bytestream2_get_le64(&p); time_unit = bytestream2_get_le64(&p);
spu = bytestream2_get_le64(&p); spu = bytestream2_get_le64(&p);
if (!time_unit || !spu) {
av_log(s, AV_LOG_ERROR, "Invalid timing values.\n");
return AVERROR_INVALIDDATA;
}
bytestream2_skip(&p, 4); /* default_len */ bytestream2_skip(&p, 4); /* default_len */
bytestream2_skip(&p, 8); /* buffersize + bits_per_sample */ bytestream2_skip(&p, 8); /* buffersize + bits_per_sample */
@ -90,7 +95,7 @@ ogm_header(AVFormatContext *s, int idx)
st->codec->channels = bytestream2_get_le16(&p); st->codec->channels = bytestream2_get_le16(&p);
bytestream2_skip(&p, 2); /* block_align */ bytestream2_skip(&p, 2); /* block_align */
st->codec->bit_rate = bytestream2_get_le32(&p) * 8; st->codec->bit_rate = bytestream2_get_le32(&p) * 8;
st->codec->sample_rate = time_unit ? spu * 10000000 / time_unit : 0; st->codec->sample_rate = spu * 10000000 / time_unit;
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
if (size >= 56 && st->codec->codec_id == AV_CODEC_ID_AAC) { if (size >= 56 && st->codec->codec_id == AV_CODEC_ID_AAC) {
bytestream2_skip(&p, 4); bytestream2_skip(&p, 4);