diff options
author | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-10-03 16:39:13 +0000 |
---|---|---|
committer | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-10-03 16:39:13 +0000 |
commit | 9a316baf5ef31e9f93841e4014b61fb70886a943 (patch) | |
tree | a007eea9667761ec8fe1711a1431e65247d8908e | |
parent | fe2fabb9fa08c6a7aef393b6aa8d144b473c16e7 (diff) | |
parent | 6b040ab5b6b08f1995fcc9c4a1f3dc4ab99590d7 (diff) | |
download | libvpx-9a316baf5ef31e9f93841e4014b61fb70886a943.tar.gz |
[automerger] libwebm: Cherrypick 5a41830 from upstream am: 0f99871368 am: 6b040ab5b6
Change-Id: I025c72102387ce965716f32b66b3768cfd4573ed
-rw-r--r-- | libwebm/mkvparser/mkvparser.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libwebm/mkvparser/mkvparser.cc b/libwebm/mkvparser/mkvparser.cc index ff1332726..70c1f043f 100644 --- a/libwebm/mkvparser/mkvparser.cc +++ b/libwebm/mkvparser/mkvparser.cc @@ -4983,29 +4983,27 @@ bool PrimaryChromaticity::Parse(IMkvReader* reader, long long read_pos, if (!reader) return false; - std::auto_ptr<PrimaryChromaticity> chromaticity_ptr; + if (!*chromaticity) + *chromaticity = new PrimaryChromaticity(); - if (!*chromaticity) { - chromaticity_ptr.reset(new PrimaryChromaticity()); - } else { - chromaticity_ptr.reset(*chromaticity); - } - - if (!chromaticity_ptr.get()) + if (!*chromaticity) return false; - float* value = is_x ? &chromaticity_ptr->x : &chromaticity_ptr->y; + PrimaryChromaticity* pc = *chromaticity; + float* value = is_x ? &pc->x : &pc->y; double parser_value = 0; - const long long value_parse_status = + const long long parse_status = UnserializeFloat(reader, read_pos, value_size, parser_value); + if (parse_status < 0 || parser_value < FLT_MIN || parser_value > FLT_MAX) + return false; + *value = static_cast<float>(parser_value); - if (value_parse_status < 0 || *value < 0.0 || *value > 1.0) + if (*value < 0.0 || *value > 1.0) return false; - *chromaticity = chromaticity_ptr.release(); return true; } |