Commit Graph

432 Commits

Author SHA1 Message Date
Tom Finegan
83a1f68944 mkvparser: Remove buf_t typedef.
- It is useless.
- It masks errors; buf_t was unsigned char*, but const buf_t was
  not seen by the compiler as const unsigned char*, which allowed
  passing a const pointer as a mutable argument to
  IMkvReader::Read at every site where buf_t was in use.

Change-Id: I293015e11c69d992e76c88ac02052a5a9a2b2c9c
2015-08-25 10:47:17 -07:00
James Zern
507471457e Merge changes Ia1265a63,I799d54df,Icfc582e4,I3425f608
* changes:
  Block::Parse: replace pos asserts w/checks
  Cluster::ParseBlockGroup: replace pos asserts w/checks
  Tags::*::Parse: replace pos asserts w/checks
  Chapters::*::Parse: replace pos asserts w/checks
2015-08-25 06:28:43 +00:00
James Zern
b18110541a Merge changes Ie4318152,I1e65f30f
* changes:
  Block::Parse: use int64 to aggregate laced frame sizes
  UnserializeFloat: check result for Inf/NaN
2015-08-25 06:25:04 +00:00
James Zern
06b4337ed8 Block::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks

BUG=23431751

Change-Id: Ia1265a639086c790a2ed542f34c2f438c153b036
2015-08-24 19:59:08 -07:00
James Zern
b366a98053 Cluster::ParseBlockGroup: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks
+ harmonize error return -1 -> E_FILE_FORMAT_INVALID

BUG=23431751

Change-Id: I799d54df62d93388b52ac325b836ab28e0860992
2015-08-24 19:59:04 -07:00
James Zern
2857b2350c Tags::*::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks
+ harmonize error return -1 -> E_FILE_FORMAT_INVALID

BUG=23431751

Change-Id: Icfc582e414a7d02ae0675ef14c047922c4a12036
2015-08-24 19:59:00 -07:00
James Zern
f1b2cfa03e Chapters::*::Parse: replace pos asserts w/checks
replace the common patterns assert(pos <= stop) / assert(pos == stop)
with error checks

BUG=23431751

Change-Id: I3425f6083456b5ab4f40497e3a192569b494dfa9
2015-08-24 19:56:07 -07:00
Tom Finegan
ca8062959a Merge "mkvparser: Cues::PreloadCuePoint now returns bool." 2015-08-25 02:22:05 +00:00
James Zern
6b4b297220 Block::Parse: use int64 to aggregate laced frame sizes
this is compared against a final total which is also int64

BUG=23488728

Change-Id: Ie4318152f9f9ae049a35d0b2724ccad129316981
2015-08-24 17:00:34 -07:00
James Zern
c0d2c9852b UnserializeFloat: check result for Inf/NaN
fail in either case

BUG=23488728

Change-Id: I1e65f30ff1cf857a5d1eb4bdedc3f842423cf15f
2015-08-24 16:49:22 -07:00
Tom Finegan
1a6dc4f210 mkvparser: Cues::PreloadCuePoint now returns bool.
Check allocations and fail appropriately.

Change-Id: Ie16d258a47e46b5e15c5c6275ea83ebead8b0f49
2015-08-24 16:20:13 -07:00
Tom Finegan
275ac22cae mkvparser: Cluster::Create clean up.
- Asserts to error condition check and return.
- Use nothrow new.

Change-Id: Iff9da5806e6f3240e7ea9f9e90ccdf729848a778
2015-08-24 16:19:10 -07:00
James Zern
064f2eed62 Segment::PreloadCluster(): return a bool status
BUG=23430793

Change-Id: I10aab67e94961868be806ee7ee9df550a5187e5a
2015-08-22 11:02:55 -07:00
James Zern
3778408b2a Segment::AppendCluster(): return a bool status
BUG=23430793

Change-Id: I6072234bfe211153ad143ccf7a3c6bbfa8cd166e
2015-08-22 11:01:47 -07:00
James Zern
e86d046c07 mkvparser: check Cluster::Create() return
BUG=23430793

Change-Id: Ie932dd2ee82d41368616999ab75ba3b213008642
2015-08-22 10:47:03 -07:00
James Zern
f9885b5882 mkvparser: check allocations
some unchecked new's are left in a few void functions, they'll be
addressed in a separate commit

BUG=23430793

Change-Id: I4953e70f4e7b0401a293c6b87c02445960e9ff9e
2015-08-22 10:47:03 -07:00
James Zern
21ee398281 mkvparser: Segment::Load fail w/missing info/tracks
convert asserts to error returns

BUG=23430793

Change-Id: Ifbfb5a2e7cd41344acc9c8d7afdf183b28dc2cd2
2015-08-22 10:47:03 -07:00
James Zern
08fb6546e8 Merge changes I264e68b2,Ife6190a4,Ibf37245f,I06efadb5,I88b5dfec, ...
* changes:
  mkvparser/Cluster: convert asserts to failure returns
  mkvparser/Tracks: convert asserts to failure returns
  mkvparser/Track: convert asserts to failure returns
  mkvparser/ContentEncoding: convert asserts to failure returns
  mkvparser/Cues: convert asserts to failure returns
  mkvparser/SeekHead: convert asserts to failure returns
  mkvparser/Segment: convert asserts to failure returns
2015-08-22 05:52:07 +00:00
James Zern
c8960955db mkvparser/Cluster: convert asserts to failure returns
Change-Id: I264e68b24eeb0f719a9d60b4cb0454e38110dd39
2015-08-21 22:49:57 -07:00
James Zern
680b4bfd3d mkvparser/Tracks: convert asserts to failure returns
BUG=23431751

Change-Id: Ife6190a4bcd4ab949165f17fd0b6c26a058a661b
2015-08-21 22:49:57 -07:00
James Zern
5889e6c18b mkvparser/Track: convert asserts to failure returns
Change-Id: Ibf37245f74e019c788b3f4121082956aa209430a
2015-08-21 22:49:57 -07:00
James Zern
5135c4cd74 mkvparser/ContentEncoding: convert asserts to failure returns
Change-Id: I06efadb5242135b095ad4cdefceef0e1c42c79b9
2015-08-21 22:49:57 -07:00
James Zern
b0e4f32011 mkvparser/Cues: convert asserts to failure returns
Change-Id: I88b5dfecfd03fec7f5808959ec6f640bff838d7a
2015-08-21 22:45:02 -07:00
James Zern
13ccc7f089 mkvparser/UnserializeInt: fix sign flip
with -funsigned-char the sign will be flipped, e.g., -128 -> 128, use an
explicit signed char.

additionally drop the misguided range check; this is meant as a data
size limit not one for the big-endian encoded ints

Change-Id: Ia10ef811d16acd09cbcd3d95856d9c460c9b7f16
2015-08-21 22:35:20 -07:00
James Zern
db3f9bbd79 mkvparser/SeekHead: convert asserts to failure returns
Change-Id: Ic2c83e4eb246fd4c1fc63fe16298f0dc78801912
2015-08-21 19:47:34 -07:00
James Zern
8de3654fdb mkvparser/Segment: convert asserts to failure returns
Change-Id: I7ccfd5be5e7438561edacb06bc8e6256aa6e0369
2015-08-21 19:46:15 -07:00
James Zern
fa2aa7da2d SeekHead::Parse(): fix assertion failure
replace assertions with failure returns

BUG=23430787
BUG=23431751

Change-Id: I22f000388cf040d064ba898c5de3658b56a3dfea
2015-08-21 18:12:08 -07:00
James Zern
d9bdadeff8 sample{,_muxer}: check SegmentInfo::GetInfo() return
prevents a segfault when parsing a corrupt file

BUG=23430793

Change-Id: I909fd456555ed0d5d871e12258b4887f36f90867
2015-08-21 16:58:04 -07:00
James Zern
07a9cf7127 Merge "mkvparser: Remove some asserts." 2015-08-21 21:28:13 +00:00
Tom Finegan
c56ee29254 mkvparser: Remove some asserts.
Remove asserts in sections recently updated to do error checking, and
replace some additional nearby asserts with error checks.

Change-Id: Ia8b60824736a7a821bbca3f2bfef5de4bb584c2d
2015-08-21 13:06:09 -07:00
Tom Finegan
d9013243ff Merge "mkvparser: Remove some asserts from SegmentInfo::Parse." 2015-08-21 19:57:35 +00:00
Rob Gaunt
7f7d898a27 Fix case sensitivity issue in iosbuild.sh.
Change-Id: I82b851b442cfe46ead78d115bbd7e22927ea6334
2015-08-21 12:27:30 -07:00
Tom Finegan
42fe2cd755 mkvparser: Remove some asserts from SegmentInfo::Parse.
Just return errors.

Change-Id: Ic3510db9c298e12cbe2a40fe09344a1c8e1e4ca8
2015-08-21 12:10:38 -07:00
Tom Finegan
8bccd9c306 Merge "mkvparser: avoid rollover in UnserializeInt()." 2015-08-21 18:47:16 +00:00
Tom Finegan
7a2fa0daf3 mkvparser: avoid rollover in UnserializeInt().
- Not strictly rollover-- avoid exceeding max 64 EBML (2^26 - 2).
- Tidy up the function.

BUG=23321923

Change-Id: I172c75064c189ed0fcf224145d016fca421f60c6
2015-08-21 11:24:30 -07:00
Tom Finegan
44f5ce64b1 mkvparser: Disallow durations in seconds greater than LONG_LONG_MAX.
libwebm cannot handle a duration in seconds greater than LONG_LONG_MAX
because it stores the values in long long variables.

BUG=23321923

Change-Id: Idb73f04a73e35829ae34386ea6c388fd355dd102
2015-08-21 10:54:27 -07:00
Tom Finegan
b521e3030e Merge "mkvparser: Segment::ParseHeaders() avoid rollover and bad int sizes." 2015-08-20 16:59:29 +00:00
Tom Finegan
7680e2a76b mkvparser: Check for errors in Match().
Confirm asserted conditions are as expected in all build
configurations, and avoid rolling over pos in obvious places.

BUG=23225325

Change-Id: I8af3192283788fd4a4b5b8ba4ad94abeab7feff2
2015-08-19 21:46:32 -07:00
Tom Finegan
39a315f8c1 mkvparser: Segment::ParseHeaders() avoid rollover and bad int sizes.
BUG=23226908

Change-Id: I177fc75684daa3c0282b63ec270d095251a70881
2015-08-19 21:23:21 -07:00
Tom Finegan
f250aceeaa mkvparser: Handle invalid lengths and rollover in ParseElementHeader().
BUG=23224239

Change-Id: I597054dc552b54f99a6716fb8f1b0f2480f2a29b
2015-08-19 12:34:54 -07:00
Tom Finegan
cd96a76985 mkvparser: Avoid rollover/truncation in UnserializeString().
Change-Id: I355d00b59ec1b7645ae5b4010e292215b5da3a17
2015-08-17 15:35:44 -07:00
Tom Finegan
8e8b3dbc6a Merge "mkvparser: Add error checking in Block::Parse." 2015-08-14 18:11:24 +00:00
James Zern
82b7e5f487 sample: correct mbstowcs() error check
mbstowcs() can return (size_t)-1 if it encounters an invalid string

BUG=23200382

Change-Id: Ibf67145be3989e16cd24c06850c7a5aa581a0ada
2015-08-14 10:57:48 -07:00
James Zern
04d7809375 sample: check allocation return
BUG=23200382

Change-Id: Ic64f76000d181f169af9aed2f7891f6ed3d28681
2015-08-14 10:57:01 -07:00
Tom Finegan
986b64b8c0 mkvparser: Add error checking in Block::Parse.
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
2015-08-14 10:45:46 -07:00
James Zern
2dec09426a mkvparser: normalize UnserializeInt signature
long size -> long long; fixes a conversion warning under visual studio

Change-Id: I216151236f4ad7e1b8af4d8b7d19e3b36083fd14
2015-08-04 19:01:06 -07:00
Francisco Facioni
b6de61a5c0 Adds support for simple tags
Change-Id: I285e4b73df0a7112bbde7ef13eddf8fdccf59178
2015-07-22 17:07:25 -03:00
Tom Finegan
75a6d2da8b sample_muxer: Don't write huge files.
sample_muxer was using the buffer size instead of the frame payload size
when passing frames to the muxer.

BUG=https://code.google.com/p/webm/issues/detail?id=1032

Change-Id: I25578934e8822553e3482ded80eaf22651be85cc
2015-07-01 14:26:55 -07:00
James Zern
cec1f8521f mkvmuxer: remove unused timecode_scale variable
unused in WriteFramesAll() / WriteFramesLessThan() since:
d6d04ac mkvmuxer: use generic Cluster::AddFrame

Change-Id: I2089dc24b6a942f342b278b46271c6144cf8351e
2015-06-17 16:23:30 -07:00
James Zern
8a61b4033e Merge "mkvparser: Tiny whitespace fix." 2015-06-10 19:10:17 +00:00