diff options
author | James Zern <jzern@google.com> | 2021-11-04 10:51:10 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2021-11-04 11:01:11 -0700 |
commit | 206d268d4d8066e5a37c49025325b80c95c771dd (patch) | |
tree | 88b96ce0c793fd2c21162bd94f318cbc604826da | |
parent | ba0e4366dc05cfb8565d78f8f30afa9bb1206862 (diff) | |
download | libwebm-206d268d4d8066e5a37c49025325b80c95c771dd.tar.gz |
mkvparser: fix int64 -> unsigned conversion warnings
in 32-bit builds:
mkvparser\mkvparser.cc(1536,42): warning C4244: 'initializing':
conversion from '__int64' to 'unsigned int', possible loss of data
the counts have previously been range checked since:
566a1e0 Add checks for overflow during parsing
Change-Id: Ib185df3f95869fba3a26ab09a1a555e5b550ebf1
-rw-r--r-- | mkvparser/mkvparser.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mkvparser/mkvparser.cc b/mkvparser/mkvparser.cc index e7cf332..de8884b 100644 --- a/mkvparser/mkvparser.cc +++ b/mkvparser/mkvparser.cc @@ -1533,14 +1533,15 @@ long SeekHead::Parse() { return E_FILE_FORMAT_INVALID; if (entry_count > 0) { - m_entries = new (std::nothrow) Entry[entry_count]; + m_entries = new (std::nothrow) Entry[static_cast<size_t>(entry_count)]; if (m_entries == NULL) return -1; } if (void_element_count > 0) { - m_void_elements = new (std::nothrow) VoidElement[void_element_count]; + m_void_elements = + new (std::nothrow) VoidElement[static_cast<size_t>(void_element_count)]; if (m_void_elements == NULL) return -1; @@ -4234,16 +4235,16 @@ long ContentEncoding::ParseContentEncodingEntry(long long start, long long size, return -1; if (compression_count > 0) { - compression_entries_ = - new (std::nothrow) ContentCompression*[compression_count]; + compression_entries_ = new (std::nothrow) + ContentCompression*[static_cast<size_t>(compression_count)]; if (!compression_entries_) return -1; compression_entries_end_ = compression_entries_; } if (encryption_count > 0) { - encryption_entries_ = - new (std::nothrow) ContentEncryption*[encryption_count]; + encryption_entries_ = new (std::nothrow) + ContentEncryption*[static_cast<size_t>(encryption_count)]; if (!encryption_entries_) { delete[] compression_entries_; compression_entries_ = NULL; @@ -4956,7 +4957,8 @@ long Track::ParseContentEncodingsEntry(long long start, long long size) { if (count <= 0) return -1; - content_encoding_entries_ = new (std::nothrow) ContentEncoding*[count]; + content_encoding_entries_ = + new (std::nothrow) ContentEncoding*[static_cast<size_t>(count)]; if (!content_encoding_entries_) return -1; @@ -5703,7 +5705,7 @@ long Tracks::Parse() { if (count <= 0) return 0; // success - m_trackEntries = new (std::nothrow) Track*[count]; + m_trackEntries = new (std::nothrow) Track*[static_cast<size_t>(count)]; if (m_trackEntries == NULL) return -1; |