Skip to content

autoname: Check for potential overflow #5081

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

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

Conversation

KrystalDelusion
Copy link
Member

What are the reasons/motivation for this change?
Fix #4983
While unlikely, a wire with a score greater than about INT32_MAX/20000 will lead to an interger overflow when trying to rename users of that wire.

Explain how this is achieved.
Call log_error if any of the wires have a score over INT32_MAX/24000. Because the score is calculated with (10000*score + new_name.size())*2, if the new name is longer than 2000 characters long then there could still be an integer overflow, but this seems sufficiently unlikely that I thought checking each wire score once was better than checking each proposal, while still allowing for a fanout of almost 90000 bits from a single wire.

If applicable, please suggest to reviewers how they can test the change.

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.

An integer overflow occurred during the Executing AUTONAME pass.
1 participant