Use SignedAmount::unsigned_abs to avoid overflow#4383
Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom Feb 4, 2026
Merged
Use SignedAmount::unsigned_abs to avoid overflow#4383TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
SignedAmount::unsigned_abs to avoid overflow#4383TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
Conversation
In debug mode, using SignedAmount::abs can lead to an integer overflow when used with SignedAmount::MIN. Use SignedAmount::unsigned_abs to avoid this.
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
TheBlueMatt
approved these changes
Feb 4, 2026
Collaborator
TheBlueMatt
left a comment
There was a problem hiding this comment.
Meh, not sure its worth bothering to test a bug that isn't even a bug in prod. The appropriate test would be a CI check that bans the abs method in our code, anyway.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4383 +/- ##
==========================================
- Coverage 86.01% 86.01% -0.01%
==========================================
Files 156 156
Lines 102857 102857
Branches 102857 102857
==========================================
- Hits 88476 88473 -3
- Misses 11871 11875 +4
+ Partials 2510 2509 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In debug mode, using
SignedAmount::abscan lead to an integer overflow when used withSignedAmount::MIN. UseSignedAmount::unsigned_absto avoid this.