Commit 8fd5c128 authored by Tom Finegan's avatar Tom Finegan

Roll libwebm a97c484b..7baf4cb

Changes:
0ae7570 Fix android build failure with NDK r15b.
9af1e59 Avoid float overflows due to casts of out of range values.
2e76d22 Add command line support for projection_type
245e7a2 mkvparser: Fix integer overflow in Block::GetTime
86fa6dc mkvparser: Fix potential overflow in Block::Parse
960b81e .clang-format: update to 4.0.1
22de626 apply clang-format
27eb0b9 Fix builds with mingw x86 and x86_64.
fbc8ab9 Improve mingw support.
e590bc2 Fix include-what-you-use warning in common/file_util.cc.
7baf4cb Merge "Fix include-what-you-use warning in common/file_util.cc."

BUG=aomedia:707

Change-Id: I003760dc74b8c6b458db39bd5c4839802cba30c0
parent 037ee412
URL: https://chromium.googlesource.com/webm/libwebm
Version: a97c484bfd6b5de4b1b61efe33089b55d810b412
Version: 7baf4cb898f5e39fcdca2d4583fd2b14f488c725
License: BSD
License File: LICENSE.txt
......
......@@ -17,6 +17,7 @@
#include <cstring>
#include <fstream>
#include <ios>
#include <string>
namespace libwebm {
......@@ -41,7 +42,12 @@ std::string GetTempFileName() {
return temp_file_name;
#else
char tmp_file_name[_MAX_PATH];
#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
errno_t err = tmpnam_s(tmp_file_name);
#else
char* fname_pointer = tmpnam(tmp_file_name);
errno_t err = (fname_pointer == &tmp_file_name[0]) ? 0 : -1;
#endif
if (err == 0) {
return std::string(tmp_file_name);
}
......@@ -65,6 +71,15 @@ uint64_t GetFileSize(const std::string& file_name) {
return file_size;
}
bool GetFileContents(const std::string& file_name, std::string* contents) {
std::ifstream file(file_name.c_str());
*contents = std::string(static_cast<size_t>(GetFileSize(file_name)), 0);
if (file.good() && contents->size()) {
file.read(&(*contents)[0], contents->size());
}
return !file.fail();
}
TempFileDeleter::TempFileDeleter() { file_name_ = GetTempFileName(); }
TempFileDeleter::~TempFileDeleter() {
......
......@@ -22,6 +22,9 @@ std::string GetTempFileName();
// Returns size of file specified by |file_name|, or 0 upon failure.
uint64_t GetFileSize(const std::string& file_name);
// Gets the contents file_name as a string. Returns false on error.
bool GetFileContents(const std::string& file_name, std::string* contents);
// Manages life of temporary file specified at time of construction. Deletes
// file upon destruction.
class TempFileDeleter {
......
......@@ -8,6 +8,8 @@
#include "mkvmuxer/mkvmuxer.h"
#include <stdint.h>
#include <cfloat>
#include <climits>
#include <cstdio>
......@@ -2667,7 +2669,7 @@ bool Cluster::QueueOrWriteFrame(const Frame* const frame) {
// and write it if it is okay to do so (i.e.) no other track has an held back
// frame with timestamp <= the timestamp of the frame in question.
std::vector<std::list<Frame*>::iterator> frames_to_erase;
for (std::list<Frame *>::iterator
for (std::list<Frame*>::iterator
current_track_iterator = stored_frames_[track_number].begin(),
end = --stored_frames_[track_number].end();
current_track_iterator != end; ++current_track_iterator) {
......
......@@ -10,6 +10,7 @@
#ifdef __ANDROID__
#include <fcntl.h>
#include <unistd.h>
#endif
#include <cassert>
......
......@@ -5035,6 +5035,10 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start,
double value = 0;
const long long value_parse_status =
UnserializeFloat(reader, read_pos, child_size, value);
if (value < -FLT_MAX || value > FLT_MAX ||
(value > 0.0 && value < FLT_MIN)) {
return false;
}
mm_ptr->luminance_max = static_cast<float>(value);
if (value_parse_status < 0 || mm_ptr->luminance_max < 0.0 ||
mm_ptr->luminance_max > 9999.99) {
......@@ -5044,6 +5048,10 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start,
double value = 0;
const long long value_parse_status =
UnserializeFloat(reader, read_pos, child_size, value);
if (value < -FLT_MAX || value > FLT_MAX ||
(value > 0.0 && value < FLT_MIN)) {
return false;
}
mm_ptr->luminance_min = static_cast<float>(value);
if (value_parse_status < 0 || mm_ptr->luminance_min < 0.0 ||
mm_ptr->luminance_min > 999.9999) {
......@@ -7903,6 +7911,10 @@ long Block::Parse(const Cluster* pCluster) {
return E_FILE_FORMAT_INVALID;
curr.len = static_cast<long>(frame_size);
// Check if size + curr.len could overflow.
if (size > LLONG_MAX - curr.len) {
return E_FILE_FORMAT_INVALID;
}
size += curr.len; // contribution of this frame
--frame_count;
......@@ -7981,6 +7993,10 @@ long long Block::GetTime(const Cluster* pCluster) const {
const long long scale = pInfo->GetTimeCodeScale();
assert(scale >= 1);
// Check if tc * scale could overflow.
if (tc != 0 && scale > LLONG_MAX / tc) {
return -1;
}
const long long ns = tc * scale;
return ns;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment