Skip to content

Conversation

@MariusVanDerWijden
Copy link
Member

fixes a bug in the gas calculation found by oss-fuzz

// Add the MSB position - 1 if expHead is non-zero
if bitLen := expHead.BitLen(); bitLen > 0 {
iterationCount += uint64(bitLen - 1)
count, carry := bits.Add64(iterationCount, uint64(bitLen-1), 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iterationCount = (expLen - 32) * multiplier also possible to overflow?

expLen can up to maxUint64?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed PTAL

@rjl493456442 rjl493456442 added this to the 1.16.4 milestone Sep 10, 2025
@rjl493456442 rjl493456442 merged commit dd7fe1b into ethereum:master Sep 10, 2025
5 of 6 checks passed
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
fixes a bug in the gas calculation found by oss-fuzz
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.

2 participants