From 49f5e33d79df3713bc510e611a5064858bf24e4a Mon Sep 17 00:00:00 2001
These files have specially crafted headers which should be
rejected by the new checks added to resolve this bug. If any
audio output is produced then this bug has re-occured.
The audio data is the phrase "invalid file", in one or six
channels, to make this more obvious.
The new mochitest test_invalid_reject.html tries to load
and play each of the new invalid files and verifies that
an error event is triggered. Since the invalid data is in
the file headers, this should happen after network load
but before metadata is ready, so the test also asserts
errors if loadedmetadata or a number of subsequent events
are triggered.
The test will time out if no error event is fired at all.
Thanks to Matthew Gregan for assistance writing the mochitest.
---
content/media/test/Makefile.in | 11 ++++++
content/media/test/invalid-cmap-s0c0.opus | Bin 0 -> 6835 bytes
content/media/test/invalid-cmap-s0c2.opus | Bin 0 -> 6834 bytes
content/media/test/invalid-cmap-s1c2.opus | Bin 0 -> 6848 bytes
content/media/test/invalid-cmap-short.opus | Bin 0 -> 6854 bytes
content/media/test/invalid-m0c0.opus | Bin 0 -> 2471 bytes
content/media/test/invalid-m0c3.opus | Bin 0 -> 2471 bytes
content/media/test/invalid-m1c0.opus | Bin 0 -> 6836 bytes
content/media/test/invalid-m1c9.opus | Bin 0 -> 6836 bytes
content/media/test/invalid-m2c0.opus | Bin 0 -> 2471 bytes
content/media/test/invalid-m2c1.opus | Bin 0 -> 2455 bytes
content/media/test/manifest.js | 14 ++++++++
content/media/test/test_invalid_reject.html | 52 ++++++++++++++++++++++++++++
13 files changed, 77 insertions(+)
create mode 100644 content/media/test/invalid-cmap-s0c0.opus
create mode 100644 content/media/test/invalid-cmap-s0c2.opus
create mode 100644 content/media/test/invalid-cmap-s1c2.opus
create mode 100644 content/media/test/invalid-cmap-short.opus
create mode 100644 content/media/test/invalid-m0c0.opus
create mode 100644 content/media/test/invalid-m0c3.opus
create mode 100644 content/media/test/invalid-m1c0.opus
create mode 100644 content/media/test/invalid-m1c9.opus
create mode 100644 content/media/test/invalid-m2c0.opus
create mode 100644 content/media/test/invalid-m2c1.opus
create mode 100644 content/media/test/test_invalid_reject.html
Verify that we return metadata tags from streams with only a
single comment by adding a single comment to a file which
previously had none.
This bug went undetected because all our examples had either
multiple tags, or none.
Remember parsed comments from the OpusTags header in
an array member variable. Add a method to generate
the nsHTMLMediaElement::MetadataTags hash table from
those entries, performing the same validatation we
do for Vorbis.
This feature is tested by adding the existing opus
test file to gMetadataTests.
IsValidVorbisTagName is moved to a static method
on nsOggCodecState so it can be shared among the
subclasses and easily called externally.
MetadataTags generation for Vorbis streams is moved
to the same method name on nsVorbisState to allow
sharing of the parsing and validation code as much
as possible, since both formats use the same scheme.
It's arguable whether contrustuction better belongs to
nsOggReader or to the nsCodecState subclasses, since in
theory the various multiplexed streams interact in
determining the canonical tag list, but it is the
per-codec streams which contain the metadata in Ogg.
Add a new test file with some invalid comments and verify
they are filtered out of the mozGetMetadata() output.
The new file includes the following valid edge cases:
- empty tag name
- empty tag value
- punctuation in the tag name
and the following invalid cases:
- non-ascii tag name
- invalid characters in tag name
- non-utf-8 tag value
- no tag=value separator
Also updates the mochitest messages to be less confusing.
Add a few Ogg files which have non-trivial tag metadata in their Vorbis streams, and verify they are returned correctly by the media.mozGetMetadata() extention.
Add a file with no comments to test {} output as well.
Verify that mozGetMetadata() throws an InvalidStateError if called immediately, before the loadedmetadata event fires.
Add a short Ogg Opus file to the content/media/test
directory and add it to the gSeekTests, gSmallTests,
and gPlayTests in manifest.js. This file is crafted
to end on a packet boundary, so trimming to duration
is not verified.
Set the media.opus.enabled pref to true in manifest.js
so the various tests using the opus file succeed.
Add a stanza to can_play_type_ogg.js to test the
behaviour of canPlayType with an opus-specific
media type for both values of the pref.
Add support for the .opus filename extension to
the mochitest http server.