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

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: HexStringToUInt64 should fail on negative input, make tests reflect that 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 | « no previous file | 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..1ef6e631d7c9541181986700dfbe38a34f3407c9 100644
--- a/base/strings/string_number_conversions.cc
+++ b/base/strings/string_number_conversions.cc
@@ -500,6 +500,9 @@ bool HexStringToInt64(const StringPiece& input, int64* output) {
}
bool HexStringToUInt64(const StringPiece& input, uint64* output) {
+ if (input[0] == '-') {
+ return false;
brettw 2013/04/24 05:42:05 The header file defines that the best effort resul
Mostyn Bramley-Moore 2013/04/24 08:19:20 The template code only seems to check for valid ne
+ }
return IteratorRangeToNumber<HexIteratorRangeToUInt64Traits>::Invoke(
input.begin(), input.end(), output);
}
« no previous file with comments | « no previous file | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698