summaryrefslogtreecommitdiff
path: root/chromium/net/http/http_security_headers.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-25 11:39:07 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-01-25 15:20:42 +0000
commit6c91641271e536ffaa88a1dff5127e42ee99a91e (patch)
tree703d9dd49602377ddc90cbf886aad37913f2496b /chromium/net/http/http_security_headers.cc
parentb145b7fafd36f0c260d6a768c81fc14e32578099 (diff)
downloadqtwebengine-chromium-6c91641271e536ffaa88a1dff5127e42ee99a91e.tar.gz
BASELINE: Update Chromium to 49.0.2623.23
Also adds missing printing sources. Change-Id: I3726b8f0c7d6751c9fc846096c571fadca7108cd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/net/http/http_security_headers.cc')
-rw-r--r--chromium/net/http/http_security_headers.cc37
1 files changed, 19 insertions, 18 deletions
diff --git a/chromium/net/http/http_security_headers.cc b/chromium/net/http/http_security_headers.cc
index b99b206c3f3..ecb8e57d2b3 100644
--- a/chromium/net/http/http_security_headers.cc
+++ b/chromium/net/http/http_security_headers.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <limits>
+
#include "base/base64.h"
-#include "base/basictypes.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_tokenizer.h"
@@ -18,36 +19,36 @@ namespace {
enum MaxAgeParsing { REQUIRE_MAX_AGE, DO_NOT_REQUIRE_MAX_AGE };
-static_assert(kMaxHSTSAgeSecs <= kuint32max, "kMaxHSTSAgeSecs too large");
+static_assert(kMaxHSTSAgeSecs <= UINT32_MAX, "kMaxHSTSAgeSecs too large");
// MaxAgeToInt converts a string representation of a "whole number" of
-// seconds into a uint32. The string may contain an arbitrarily large number,
+// seconds into a uint32_t. The string may contain an arbitrarily large number,
// which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit
// within a 32-bit unsigned integer. False is returned on any parse error.
bool MaxAgeToInt(std::string::const_iterator begin,
std::string::const_iterator end,
- uint32* result) {
+ uint32_t* result) {
const base::StringPiece s(begin, end);
if (s.empty())
return false;
- int64 i = 0;
-
- // Return false on any StringToInt64 parse errors *except* for
- // int64 overflow. StringToInt64 is used, rather than StringToUint64,
- // in order to properly handle and reject negative numbers
- // (StringToUint64 does not return false on negative numbers).
- // For values too large to be stored in an int64, StringToInt64 will
- // return false with i set to kint64max, so this case is detected
- // by the immediately following if-statement and allowed to fall
- // through so that i gets clipped to kMaxHSTSAgeSecs.
- if (!base::StringToInt64(s, &i) && i != kint64max)
+ int64_t i = 0;
+
+ // Return false on any StringToInt64 parse errors *except* for int64_t
+ // overflow. StringToInt64 is used, rather than StringToUint64, in order to
+ // properly handle and reject negative numbers (StringToUint64 does not return
+ // false on negative numbers). For values too large to be stored in an
+ // int64_t, StringToInt64 will return false with i set to
+ // std::numeric_limits<int64_t>::max(), so this case is detected by the
+ // immediately following if-statement and allowed to fall through so that i
+ // gets clipped to kMaxHSTSAgeSecs.
+ if (!base::StringToInt64(s, &i) && i != std::numeric_limits<int64_t>::max())
return false;
if (i < 0)
return false;
if (i > kMaxHSTSAgeSecs)
i = kMaxHSTSAgeSecs;
- *result = (uint32)i;
+ *result = (uint32_t)i;
return true;
}
@@ -128,7 +129,7 @@ bool ParseHPKPHeaderImpl(const std::string& value,
GURL* report_uri) {
bool parsed_max_age = false;
bool include_subdomains_candidate = false;
- uint32 max_age_candidate = 0;
+ uint32_t max_age_candidate = 0;
GURL parsed_report_uri;
HashValueVector pins;
bool require_max_age = max_age_status == REQUIRE_MAX_AGE;
@@ -224,7 +225,7 @@ bool ParseHPKPHeaderImpl(const std::string& value,
bool ParseHSTSHeader(const std::string& value,
base::TimeDelta* max_age,
bool* include_subdomains) {
- uint32 max_age_candidate = 0;
+ uint32_t max_age_candidate = 0;
bool include_subdomains_candidate = false;
// We must see max-age exactly once.