mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 951770 - Reject invalid WebM/Opus files. r=rillian
Verify WebM CodecDelay matches the pre-skip value in CodecPrivate.
This commit is contained in:
parent
4e8f7e83d0
commit
be2c19ae74
@ -372,7 +372,7 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
||||
mHasAudio = true;
|
||||
mInfo.mAudio.mHasAudio = true;
|
||||
mAudioCodec = nestegg_track_codec_id(mContext, track);
|
||||
mCodecDelay = params.codec_delay;
|
||||
mCodecDelay = params.codec_delay / NS_PER_USEC;
|
||||
|
||||
if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
|
||||
// Get the Vorbis header data
|
||||
@ -439,6 +439,12 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (mCodecDelay != FramesToUsecs(mOpusParser->mPreSkip, mOpusParser->mRate).value()) {
|
||||
LOG(PR_LOG_DEBUG, ("Values for CodecDelay and PreSkip do not match\n"))
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInfo.mAudio.mRate = mOpusParser->mRate;
|
||||
|
||||
mInfo.mAudio.mChannels = mOpusParser->mChannels;
|
||||
@ -718,7 +724,7 @@ bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
||||
NS_WARNING("Int overflow converting WebM audio duration");
|
||||
return false;
|
||||
}
|
||||
CheckedInt64 time = startTime - (mCodecDelay / NS_PER_USEC);
|
||||
CheckedInt64 time = startTime - mCodecDelay;
|
||||
if (!time.isValid()) {
|
||||
NS_WARNING("Int overflow shifting tstamp by codec delay");
|
||||
nestegg_free_packet(aPacket);
|
||||
|
@ -215,7 +215,7 @@ private:
|
||||
// Number of audio frames we've decoded since decoding began at mAudioStartMs.
|
||||
uint64_t mAudioFrames;
|
||||
|
||||
// Number of nanoseconds that must be discarded from the start of the Stream.
|
||||
// Number of microseconds that must be discarded from the start of the Stream.
|
||||
uint64_t mCodecDelay;
|
||||
|
||||
// Parser state and computed offset-time mappings. Shared by multiple
|
||||
|
Loading…
Reference in New Issue
Block a user