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

Unified Diff: base/strings/string_number_conversions.cc

Issue 14109020: HexStringToUInt64 should fail for negative input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clamp to closest value in the type range Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_number_conversions.cc
diff --git a/base/strings/string_number_conversions.cc b/base/strings/string_number_conversions.cc
index fadc81a186f6631a5e5226e49a1e11b969ec2f70..c9b11156ff095e8716c15370881e7ee3e6509555 100644
--- a/base/strings/string_number_conversions.cc
+++ b/base/strings/string_number_conversions.cc
@@ -186,7 +186,9 @@ class IteratorRangeToNumber {
}
if (begin != end && *begin == '-') {
- if (!Negative::Invoke(begin + 1, end, output)) {
+ if (!std::numeric_limits<value_type>::is_signed) {
+ valid = false;
+ } else if (!Negative::Invoke(begin + 1, end, output)) {
valid = false;
}
} else {
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698