Confirm asserted conditions are as expected in all build
configurations, and avoid rolling over pos in obvious places.
BUG=23225325
Change-Id: I8af3192283788fd4a4b5b8ba4ad94abeab7feff2
Instead of relying solely on asserts, which compile away to
nothing in downstream projects using libwebm for parsing webm
input streams, actually check for the conditions being asserted,
and return errors when appropriate.
Change-Id: Id8b6352e8dda69782129dcea8f67203fd9c4f572
Re-run clang-format to pick up some missed changes over the past
few CLs. Also update the .clang-format file to break after ternary
operator.
Change-Id: Ia4ba4e58362c2dbe36aeb33894f0411af33ef17d
Fix EBML lacing block parsing when attempting to parse the last frame
on single-frame videos and assertion when frame_count is lower
than actual data in the file.
Change-Id: I223e30be54970ef75126c6c4ee3401cbeb92e02f
Fixed block parsing to account to cases that would
allow frame_size = 0, only to be rejected later on
Block::GetFrame assert(f.len > 0);
Change-Id: Idb93388b37e1963ec6115ac49f15e4951bc2c724
Malformed files woudl cause the parser to assert.
Instead now it stops parsing and skips the segment.
Change-Id: I256b3b72e43f969693ae16547ca98da07d665e21
Changed assertions to "invalid file format" errors files that
had Block Groups without Block IDs or had invalid sizes or
durations
Change-Id: I1383a63bfb76ee46aaa0aff089780383ce65fc31
Malformed files would cause the parser to assert.
Instead now it stops parsing and skips the segment.
Change-Id: I07e3baf5c9eb6feb115e155f226d8abc2c37698e
If a malformed webm file contains invalid information on the Cues
the segment, the parser would assert.
Instead, now it ignores the Cues and skips the segment.
Change-Id: I9270f6a0935ce9e9a3765a5f324ae542c1ade1c7
previously only empty clusters of known size were accepted; with
clusters of unknown size the cluster has been successfully parsed and a
working copy of the file position updated, so parsing can continue.
clusters of this type are discarded as clusters of known size currently
are.
Change-Id: I3ef848768519ab7f1887a11629c50af72249cead
the element length was being read twice; the second attempt would
consume a portion of the discard padding field often failing due to
limitations in GetUIntLength.
Change-Id: Ibbe3f082e2d05460734a0e1f7d23f3c665e3f24b
mkvparser::UnserializeUInt() assumes that unsigned values never have
their high bit set. This is too limiting for UUIDs. In addition, the
Chapters::Atom::Parse() method would truncate a "negative" 64-bit UUID
value to 32 bits and return the truncated value as a status code.
This value then might or might not be treated as an error by the caller
depending on whether the truncated value was itself negative.
Change-Id: I15624ac62d0b02691a1405ee6a5f7eb441b3bc48
Track::GetDefaultDuration is implemented as an alternative
to VideoTrack::GetFrameRate which seems to be deprecated.
Change-Id: I2c7a6d56a232125b8632d87eab75b9600c5451e1
To support seek in generic tracks with subtitles the audio track
implementation of seek is made generic and inherited by audio track.
Change-Id: Ic88d2e859d077a1054b2af7d7680cfddfba8a589
Track::GetLanguageAsUTF8 is implemented to allow the user to
choose between available audio and subtitle tracks.
Change-Id: I5ec9b1c1c00182da759681ba486cbace46e9b63f
Normally, if a sub-element of a cluster reports a size
that lies beyond the end of its enclosing cluster, we
would treat this as a malformed stream and immediately
terminate the parse.
However, if the sub-element is not a simple block or block
group, we would ignore the (sub)element anyway, so there
doesn't appear to be any harm in just concontinuing to
ignore the (sub)element, and treating this case as if
we had reached the end-of-cluster in the normal way.
Change-Id: I16c0a44f7458823ed579612d917b09ee08a8d90a
ParseTrackEntry handled MKVs with 0-sized EBML elements
as malformed. Relaxing this and allow empty elements to allow
parsing such MKV content.
Change-Id: I7e430e9b2d177df7fe1e656546f63ee8673e784e
Modified the mkvmuxer to write the ChapterStringUID
sub-element of the Chapter Atom element.
Modified the mkvparser to read the ChapterStringUID
sub-element of the chapter atom.
Modified the vttdemux app to write the Cue Identifier
line of the WebVTT cue.
Change-Id: I06fe386f44897ada3fe10cbf89096df104dcf779
Formerly, it was only possible to create instances of
the Track subclasses, VideoTrack and AudioTrack. However,
we now populate WebM files with WebVTT metadata blocks,
so we must allow for a third kind of track object.
We now enable instances of type Track to be created,
by providing a new factory function, Track::Create, and
making all Track methods non-pure and with a generic
implementation.
Change-Id: I7d4c965eb566b9fc2f5ceefe1d43723cf8c1e5f0
- Segment::CreateInstance was treating the available data as EOF
and returning errors.
- Added a check for potential underflow if the segment was not the
first element after the EBML header.
Change-Id: I481bf0eea71eeb3def3bf54ec251be0b2ae13536
- Added ContentEncAESSettings, AESSettingsCipherMode,
AESSettingsCipherInitData elements to the parser and muxer.
- Changed ParseContentEncodingsEntry, ParseContentEncodingEntry,
and ParseEncryptionEntry to use PasreElementHeader.
- Added ParseContentEncAESSettingsEntry function.
- PS6 removed AESSettingsCipherInitData.
- PS9 Addressed comments, Fixed some LINT issues, and converted
mkvwriter.h/.cpp to Unix line endings.
- PS10 Addressed comments.
Change-Id: I9d96a0c194f74a6c9bf0001aa0286196e410f07e
In several cases, the parser would parse a header
(say, a track header, or the segment info header)
in the constructor for the type. The parser had
assumed (incorrectly) that the file was well-formed,
but this turned out to be an incorrect assumption.
The parse errors triggered some assertion failures,
but this is not acceptable in a production system.
The parser solved that problem by separating the
construction of the header object from the parsing
of the file. There is now a separate parse method
to be called after construction of the object,
which returns a status whether the parse was
successful.
This change fixes the bugs from the following
tracker issues:
http://code.google.com/p/webm/issues/detail?id=399http://code.google.com/p/webm/issues/detail?id=400
Change-Id: Idb09154ae7008429d8613ce3b3e8294f5a12de86
Previously, parsing of a Block element was done inside its
constructor. Parsing errors were handled via assertion checks,
but this only works in practice if there are no actual errors
in the file.
We did come across a file, however, that used EMBL-style lacing,
but the lacing was done incorrectly and so the parse asserted.
This isn't acceptable for a production system, and more a graceful
handling of parse errors was needed.
The code was restructured such that the Block object's ctor does
only trivial initialization of member variables. A separate Parse
method was added, that is called after the object is constructed.
If the parse succeeds all is well, otherwise the object is destroyed
and the error is reported to the caller.
This commit fixes bug tracker issue #398, described here:
http://code.google.com/p/webm/issues/detail?id=398
Change-Id: Ib95ca95d0eec08cf670b308c461e42ed8345e890