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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 2405453002: Fix Integer-overflow in base::Time::FromExploded. (Closed)
Patch Set: rebased and fixed net unittest Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 // TODO(acolwell): Update this parsing code when FFmpeg returns sub-second 747 // TODO(acolwell): Update this parsing code when FFmpeg returns sub-second
748 // information. 748 // information.
749 std::vector<base::StringPiece> time_fields = base::SplitStringPiece( 749 std::vector<base::StringPiece> time_fields = base::SplitStringPiece(
750 fields[1], ":", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 750 fields[1], ":", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
751 if (time_fields.size() != 3) 751 if (time_fields.size() != 3)
752 return false; 752 return false;
753 753
754 base::Time::Exploded exploded; 754 base::Time::Exploded exploded;
755 exploded.millisecond = 0; 755 exploded.millisecond = 0;
756 // This field cannot be uninitialized. Unless not modified, make it 0 here
757 // then.
758 exploded.day_of_week = 0;
756 if (base::StringToInt(date_fields[0], &exploded.year) && 759 if (base::StringToInt(date_fields[0], &exploded.year) &&
757 base::StringToInt(date_fields[1], &exploded.month) && 760 base::StringToInt(date_fields[1], &exploded.month) &&
758 base::StringToInt(date_fields[2], &exploded.day_of_month) && 761 base::StringToInt(date_fields[2], &exploded.day_of_month) &&
759 base::StringToInt(time_fields[0], &exploded.hour) && 762 base::StringToInt(time_fields[0], &exploded.hour) &&
760 base::StringToInt(time_fields[1], &exploded.minute) && 763 base::StringToInt(time_fields[1], &exploded.minute) &&
761 base::StringToInt(time_fields[2], &exploded.second)) { 764 base::StringToInt(time_fields[2], &exploded.second)) {
762 if (base::Time::FromUTCExploded(exploded, out)) 765 if (base::Time::FromUTCExploded(exploded, out))
763 return true; 766 return true;
764 } 767 }
765 768
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 TEST_COLORSPACE(RESERVED); 828 TEST_COLORSPACE(RESERVED);
826 TEST_COLORSPACE(FCC); 829 TEST_COLORSPACE(FCC);
827 TEST_COLORSPACE(BT470BG); 830 TEST_COLORSPACE(BT470BG);
828 TEST_COLORSPACE(SMPTE170M); 831 TEST_COLORSPACE(SMPTE170M);
829 TEST_COLORSPACE(SMPTE240M); 832 TEST_COLORSPACE(SMPTE240M);
830 TEST_COLORSPACE(YCOCG); 833 TEST_COLORSPACE(YCOCG);
831 TEST_COLORSPACE(BT2020_NCL); 834 TEST_COLORSPACE(BT2020_NCL);
832 TEST_COLORSPACE(BT2020_CL); 835 TEST_COLORSPACE(BT2020_CL);
833 836
834 } // namespace media 837 } // namespace media
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_usage_store_unittest.cc ('k') | media/formats/webm/webm_info_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698