lib: coerce -0 to +0 in various APIs#63556
Conversation
|
Review requested:
|
| validateUint32(interval, 'interval'); | ||
| // Coerce -0 to +0. | ||
| interval += 0; |
There was a problem hiding this comment.
Shouldn't we update validateUint32 to reject -0 instead?
There was a problem hiding this comment.
I have no particular sympathy for either or.
There was a problem hiding this comment.
Having it part of the helper is probably more robust than relying on humans to remember for checking for -0
There was a problem hiding this comment.
Having it part of the helper is probably more robust than relying on humans to remember for checking for
-0
Maybe even have it part of all uint conversion helpers?
There was a problem hiding this comment.
we can certainly start blanket rejecting -0 from these validators in a semver-major followup if you feel like picking it up. #63531 already went the same route of this PR and is in the commit-queue
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63556 +/- ##
=======================================
Coverage 90.32% 90.32%
=======================================
Files 730 730
Lines 234653 234705 +52
Branches 43940 43939 -1
=======================================
+ Hits 211953 212004 +51
- Misses 14414 14425 +11
+ Partials 8286 8276 -10
🚀 New features to boost your workflow:
|
ljharb
left a comment
There was a problem hiding this comment.
i think fixing the C++ side also is a good idea, but can/should be done separately
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
bb206e1 to
ae9e27c
Compare
Followup to #63531
This is not an exhaustive list of these occurences, just the ones I can remotely imagine being exposed to an untrusted user input through a web-based or CLI interface.
The tests demonstrate the process crashing before the
./libchanges.I used Codex to find and confirm these before diving in.