Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]replacement the abs() with unsigned_abs() #4921

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

maldiohead
Copy link

@maldiohead maldiohead commented Jun 27, 2024

abs() may be lead to panic in the debug mode and optimized code will return i64::MIN without a panic. so need use unsigned_abs() in here

Description

The absolute value of i64::MIN cannot be represented as an i64, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return i64::MIN without a panic. so
in here need replace abs() with unsigned_abs()

Applicable issues

  • fixes #

Additional info (benefits, drawbacks, caveats)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

@maldiohead maldiohead requested a review from a team as a code owner June 27, 2024 10:04
@CLAassistant
Copy link

CLAassistant commented Jun 27, 2024

CLA assistant check
All committers have signed the CLA.

@wileyj
Copy link
Contributor

wileyj commented Jun 28, 2024

@maldiohead can you rebase against develop and we'll take a look?

@maldiohead maldiohead changed the base branch from master to develop June 28, 2024 09:48
@maldiohead maldiohead requested review from a team as code owners June 28, 2024 09:48
@maldiohead maldiohead force-pushed the fix/replacement-abs()-with-unsigned_abs() branch from 455f1eb to f3206f3 Compare June 28, 2024 09:56
@maldiohead
Copy link
Author

@wileyj Hey, I have rebase to the develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants