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

Issue 14109020: HexStringToUInt64 should fail for negative input (Closed)

Created:
7 years, 8 months ago by Mostyn Bramley-Moore
Modified:
7 years, 7 months ago
Reviewers:
felipeg, brettw
CC:
chromium-reviews, erikwright+watch_chromium.org, jshin+watch_chromium.org, Daniel Bratell, jar (doing other things), Raphael Kubo da Costa (rakuco)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Feeding negative numbers to the HexStringToUInt64 should fail, with output 0 (the closest value in the datatype's range). Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=197614

Patch Set 1 #

Patch Set 2 : HexStringToUInt64 should fail on negative input, make tests reflect that #

Total comments: 2

Patch Set 3 : move negativeness check in HexStringToUInt64 into the template code #

Patch Set 4 : rebase, revert change to the test result checking, set defined error output values #

Patch Set 5 : undo inadvertent change #

Patch Set 6 : clamp to closest value in the type range #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -8 lines) Patch
M base/strings/string_number_conversions.h View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M base/strings/string_number_conversions.cc View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M base/strings/string_number_conversions_unittest.cc View 1 2 3 4 5 1 chunk +6 lines, -6 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Mostyn Bramley-Moore
This patch removes some invalid test cases that were introduced in https://chromiumcodereview.appspot.com/14103008
7 years, 8 months ago (2013-04-13 13:46:08 UTC) #1
felipeg
LGTM my fault, sorry for that
7 years, 8 months ago (2013-04-13 13:50:23 UTC) #2
commit-bot: I haz the power
No LGTM from a valid reviewer yet. Only full committers are accepted. Even if an ...
7 years, 8 months ago (2013-04-13 13:54:43 UTC) #3
brettw
I'm confused, shouldn't the output for these cases be well-defined? It seems like we should ...
7 years, 8 months ago (2013-04-14 04:22:49 UTC) #4
Mostyn Bramley-Moore
On 2013/04/14 04:22:49, brettw wrote: > I'm confused, shouldn't the output for these cases be ...
7 years, 8 months ago (2013-04-14 07:24:47 UTC) #5
brettw
Seems like we should be able to do "static_cast<uint64>(-66)". Did you try something like that? ...
7 years, 8 months ago (2013-04-15 04:36:52 UTC) #6
Mostyn Bramley-Moore
On 2013/04/15 04:36:52, brettw wrote: > Seems like we should be able to do "static_cast<uint64>(-66)". ...
7 years, 8 months ago (2013-04-15 08:44:59 UTC) #7
brettw
Sorry this fell off my radar, feel free to ping me if I take so ...
7 years, 8 months ago (2013-04-24 05:42:05 UTC) #8
Mostyn Bramley-Moore
https://codereview.chromium.org/14109020/diff/7001/base/strings/string_number_conversions.cc File base/strings/string_number_conversions.cc (right): https://codereview.chromium.org/14109020/diff/7001/base/strings/string_number_conversions.cc#newcode504 base/strings/string_number_conversions.cc:504: return false; On 2013/04/24 05:42:05, brettw wrote: > The ...
7 years, 8 months ago (2013-04-24 08:19:20 UTC) #9
Mostyn Bramley-Moore
brettw: *ping* :) Any thoughts on patchset 3?
7 years, 8 months ago (2013-04-26 08:58:23 UTC) #10
brettw
Great, that's definitely the right way to check for negative. But the behavior still doesn't ...
7 years, 8 months ago (2013-04-27 21:23:42 UTC) #11
Mostyn Bramley-Moore
On 2013/04/27 21:23:42, brettw wrote: > Great, that's definitely the right way to check for ...
7 years, 8 months ago (2013-04-27 21:46:06 UTC) #12
Mostyn Bramley-Moore
In patchset 4/5 I added back the original test result checking (since we have defined ...
7 years, 8 months ago (2013-04-27 23:18:04 UTC) #13
brettw
Nice catch for the "-" string input case. The comment is worded weirdly, since I ...
7 years, 7 months ago (2013-04-30 21:52:19 UTC) #14
Mostyn Bramley-Moore
Sounds OK to me- done in patchset 6. We lose the ability to distinguish between ...
7 years, 7 months ago (2013-04-30 23:14:55 UTC) #15
brettw
LGTM. Let's do any additional work in a separate patch, this one has dragged on ...
7 years, 7 months ago (2013-04-30 23:26:29 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mostynb@opera.com/14109020/24001
7 years, 7 months ago (2013-04-30 23:41:56 UTC) #17
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 7 months ago (2013-05-01 00:01:44 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mostynb@opera.com/14109020/24001
7 years, 7 months ago (2013-05-01 05:14:58 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mostynb@opera.com/14109020/24001
7 years, 7 months ago (2013-05-01 13:05:23 UTC) #20
commit-bot: I haz the power
7 years, 7 months ago (2013-05-01 14:22:17 UTC) #21
Message was sent while issue was closed.
Change committed as 197614

Powered by Google App Engine
This is Rietveld 408576698