Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Side by Side Diff: media/formats/webm/webm_info_parser.cc

Issue 2405453002: Fix Integer-overflow in base::Time::FromExploded. (Closed)
Patch Set: rebased and fixed net unittest Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/test/pipeline_integration_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/webm/webm_info_parser.h" 5 #include "media/formats/webm/webm_info_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/formats/webm/webm_constants.h" 8 #include "media/formats/webm/webm_constants.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return false; 79 return false;
80 80
81 int64_t date_in_nanoseconds = 0; 81 int64_t date_in_nanoseconds = 0;
82 for (int i = 0; i < size; ++i) 82 for (int i = 0; i < size; ++i)
83 date_in_nanoseconds = (date_in_nanoseconds << 8) | data[i]; 83 date_in_nanoseconds = (date_in_nanoseconds << 8) | data[i];
84 84
85 base::Time::Exploded exploded_epoch; 85 base::Time::Exploded exploded_epoch;
86 exploded_epoch.year = 2001; 86 exploded_epoch.year = 2001;
87 exploded_epoch.month = 1; 87 exploded_epoch.month = 1;
88 exploded_epoch.day_of_month = 1; 88 exploded_epoch.day_of_month = 1;
89 exploded_epoch.day_of_week = 1;
89 exploded_epoch.hour = 0; 90 exploded_epoch.hour = 0;
90 exploded_epoch.minute = 0; 91 exploded_epoch.minute = 0;
91 exploded_epoch.second = 0; 92 exploded_epoch.second = 0;
92 exploded_epoch.millisecond = 0; 93 exploded_epoch.millisecond = 0;
93 base::Time out_time; 94 base::Time out_time;
94 if (!base::Time::FromUTCExploded(exploded_epoch, &out_time)) 95 if (!base::Time::FromUTCExploded(exploded_epoch, &out_time))
95 return false; 96 return false;
96 date_utc_ = out_time + 97 date_utc_ = out_time +
97 base::TimeDelta::FromMicroseconds(date_in_nanoseconds / 1000); 98 base::TimeDelta::FromMicroseconds(date_in_nanoseconds / 1000);
98 } 99 }
99 return true; 100 return true;
100 } 101 }
101 102
102 bool WebMInfoParser::OnString(int id, const std::string& str) { 103 bool WebMInfoParser::OnString(int id, const std::string& str) {
103 return true; 104 return true;
104 } 105 }
105 106
106 } // namespace media 107 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/test/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698