Commit Graph

32 Commits

Author SHA1 Message Date
Tom Finegan
6ab4f8fa97 Limit string element size to 20 million bytes.
Avoids crashes in allocators when fuzzers or maliciously
crafted streams make elements appear extremely large.

BUG=b/68352235

Change-Id: I71c293d8abdff0d188a881c4366bc09182ac32f8
2018-01-30 15:00:40 -08:00
Lisa Velden
d707c67276 Replace uses of deprecated std::auto_ptr with std::unique_ptr.
Change-Id: I8d67fc6f3ce168f4d8b6330549f766dbf5374d61
2018-01-24 11:37:37 +01:00
Tom Finegan
1653953c39 Silence -Wdeprecated-declarations in GCC 4.7+.
Change-Id: I63a8bdb0649452a8e50b579f61bc4ea5d7e294f7
2017-12-18 11:35:40 -08:00
Tom Finegan
7dd0b80931 Avoid overflows in Block::GetTimeCode().
BUG=b/66854237

Change-Id: I721bfa0579597995ae0b488f69bcf17aba6c32c6
2017-09-30 12:14:05 -07:00
Vignesh Venkatasubramanian
86fa6dc2cb mkvparser: Fix potential overflow in Block::Parse
BUG=b/65045341

Change-Id: I198e72ea3859d2382a34e1e6dca957f9323af278
2017-08-25 11:28:01 -07:00
Vignesh Venkatasubramanian
245e7a258a mkvparser: Fix integer overflow in Block::GetTime
tc * scale could overflow theoretically (as it did in a fuzzed
file). The return -1 isn't really well defined, but that'll
probably do given this this is an extreme outlier case.

BUG=b/64953172

Change-Id: Id4aba673c3f85dee6ee25cc5f4b2db73b30ca8b3
2017-08-23 12:12:19 -07:00
Tom Finegan
9af1e59995 Avoid float overflows due to casts of out of range values.
BUG=b/37478056

Change-Id: I4eb9e6be25de6c682a252c7a1252ef040edd9eb1
2017-07-28 14:19:07 -07:00
James Zern
a97c484bfd Merge "disable -Wdeprecated-declarations in legacy code" 2017-06-22 02:02:16 +00:00
James Zern
90967863b2 mkvparser: fix float conversion warning
Change-Id: I2b79a6af431f9c51e5c32c75da18645674ebbb4d
2017-06-20 19:20:01 -07:00
James Zern
84e82579f7 disable -Wdeprecated-declarations in legacy code
this avoids downstream projects from needing to add this flag to their
build.

BUG=webm:1445

Change-Id: I03f3cc20496bc52245b6c3c013ae3c13936f4b4f
2017-06-20 19:18:42 -07:00
James Zern
300d6d8719 CuePoint::Find: check Track pointer
replace assert with a check of the pointer, this is a public function so
should be tolerant of invalid parameters

BUG=webm:1415

Change-Id: I28a3a2ef905d62f11928dbbe54c119411d2b1f74
2017-04-19 23:24:27 -07:00
James Zern
a0d27f0d51 mkvparser,Block::Parse: remove incorrect assert
this path has been error checked since:
986b64b mkvparser: Add error checking in Block::Parse.

BUG=webm:1405

Change-Id: I1c17c05076455f25ab888555d71d7b27c032e9dd
2017-04-18 12:45:43 -07:00
James Zern
2cef4d51a2 mkvparser:Parse: s/FLT_MIN/-FLT_MAX/
FLT_MIN is the smallest finite value (numeric_limits::min()) -FLT_MAX is
the correct for the most negative (numeric_limits::lowest())

http://en.cppreference.com/w/cpp/types/numeric_limits

BUG=b/36255773
BUG=webm:1381

Change-Id: Iaaff611acffc3df28fef12af81ac5299791f0148
2017-03-23 16:27:41 -07:00
Tom Finegan
5a418303e3 mkvparser: Avoid double free when Chromaticity parse fails.
PrimaryChromaticity::Parse never owns the PrimaryChromaticity
it allocates-- avoid freeing it because doing so results in a
double free when the MasteringMetadata dtor runs.

BUG=webm:1381

Change-Id: Ief0159f6ab667234e3fdc51c65f23ef5efb32a71
2017-03-21 10:44:09 -07:00
Tom Finegan
67e3ffa908 mkvparser: Avoid casts of values too large for float in Projection elements.
Return a parse error when values are out of range.

BUG=b/36255773

Change-Id: I977c41c9108b97592f3707bf8c01373cf36f2365
2017-03-20 14:03:19 -07:00
KO Myung-Hun
c36112caa0 mkvparser: #include sys/type.h
On OS/2, off_t requires sys/types.h.

Change-Id: Ic307347a62754b0b6d940c4d89228038f5f4e84b
2017-02-01 20:13:14 +00:00
Tom Finegan
81c73fc78e mkvparser: Avoid alloc failures in SeekHead::Parse.
Some run times return NULL pointers when creating 0 length
arrays. Avoid the inconsistency by skipping allocation when
the length of the SeekHead entry or void element array
is 0.

BUG=webm:1313

Change-Id: I28b4eac1d3e0ba968147637883f6e37c089e8573
2016-10-31 12:11:56 -07:00
James Zern
6db32d5f6e mkvparser,Projection::Parse: fix int->bool conv
this would have incorrectly returned true on parse failure

Change-Id: I1ae6fc2aae09491aa3cda47a5414529fc7a3848f
2016-10-17 23:34:06 -07:00
James Zern
0e179d683e update .clang-format
generated by version 3.8.1
local changes from --style=Google

3a4
> # Generated with clang-format 3.8.1
10c11
< AlignTrailingComments: true
---
> AlignTrailingComments: false
15,16c16,17
< AllowShortIfStatementsOnASingleLine: true
< AllowShortLoopsOnASingleLine: true
---
> AllowShortIfStatementsOnASingleLine: false
> AllowShortLoopsOnASingleLine: false
37c38
< BreakBeforeTernaryOperators: true
---
> BreakBeforeTernaryOperators: false

Change-Id: I4ded7e36fb8bd5407cfba6d1c4f86e0bec620c0c
2016-10-17 15:41:56 -07:00
Tom Finegan
826436a42f mkvparser: minor SeekHead::Entry clean up.
- Store actual element ID in SeekHead::Entry id field (instead
  of a decoded EBML int, which is completely _wrong_).
- Add a SeekHead::Entry constructor so we get initialized values
  in SeekHead::Entry's when parsing an Entry fails.

Change-Id: I152fae54628cb84918917139dba0cd0b42a44a57
2016-08-31 10:00:04 -07:00
Tom Finegan
41e814a008 mkvparser: Add Projection element support.
Part of the Spherical Video V2 draft specification:
https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md

Change-Id: I431349898b4018189cc58ce2cd67158ffb4c7f80
2016-08-29 14:29:30 -07:00
Tom Finegan
4b0690faa2 parser_tests: Add invalid lacing test.
Also fixes leak this test exposed in mkvparser::Cluster.

Change-Id: I06ae11b72bc89219b6b2b407b4cc215982e3ae65
2016-08-19 11:57:05 -07:00
Tom Finegan
f46566f19a mkvreader: Fix shorten-64-to-32 warning in 32 bit builds.
BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1207

Change-Id: Ie1c97a314fefdf14dce455da16f5a29218ba4cf8
2016-05-06 11:40:48 -07:00
Tom Finegan
ef464c2a95 mkvparser: Fix implicit conversion warnings.
Fix warnings exposed by addition of compiler flag
-Wshorten-64-to-32.

Change-Id: I9adcfa97babbda1a5d94fe06ec84eab69eb8d842
2016-04-08 09:23:35 -07:00
Tom Finegan
1f2432397f msvc/hdr_util: Silence double to float conversion warnings.
- Use float instead of double for Colour children in mkvparser.
- Add casts where appropriate.

Change-Id: Ia0f7e4dc25536cd43bc5e9439c58770dc3d79bc5
2016-03-31 10:43:05 -07:00
Tom Finegan
da6439685d cmake/msvc: Disable C4996 project wide.
MSVC C4996 triggers upon use of functions like fopen, and suggests
use of non-portable Microsoft replacements. Disable it project wide,
and remove the pragmas littered throughout the tree.

Change-Id: I8b890bbfd3cd7224c25350bd28f334facd8b7783
2016-03-30 12:32:22 -07:00
James Zern
3fa6aecb7f mkvparser::BlockEntry: inline EOS()
Change-Id: I1cd5ef4e438a285c733c9246411513f670c2c9c4
2016-03-29 16:55:42 -07:00
Tom Finegan
cbe5c40d12 Restore original namespaces for mkvmuxer and mkvparser.
Wrapping mkvmuxer and mkvparser in the libwebm namespace is no
longer necessary now that the tree reorganization is complete.
Put mkvmuxer and mkvparser namespaces back in the global
namespace to avoid unnecessary churn in downstream code.

Change-Id: I13a4fe0143d20bb2bb6038078c68636ff2af0c29
2016-03-21 14:41:49 -07:00
Tom Finegan
504e0f2d5b Mass file extension update.
- Use .cc and .h everywhere.
- Update includes/include guards.
- Remove extra makefile targets necessitated by previous mix
  of cpp/cc.

Change-Id: I7aad29152d4177937f8f42927c16c6572228c104
2016-03-21 14:41:47 -07:00
Tom Finegan
01db4c2d83 webmids: Move to common/ sub dir.
Change-Id: I87d0cbd78203a6680108e9e36588ff35e7ae8a4e
2016-03-21 14:41:24 -07:00
Tom Finegan
235ce59396 mkvparser: Explicitly reference internal sources in includes.
Change-Id: I09f2ab1e6fd4a41b242931e12cb4f147f8019247
2016-03-21 14:41:24 -07:00
Tom Finegan
008aa63d6a mkvparser: move to mkvparser sub dir.
Move mkvparser and mkvreader to mkvparser/.

Change-Id: I18c4575483f628344034d81b7d90d3aa86c163ff
2016-03-18 10:22:22 -07:00