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(interpreter): avoid overflow when checking if mem limit reached #1429

Merged
merged 1 commit into from
May 17, 2024

Conversation

grandizzy
Copy link
Contributor

I hit this panic while doing intensive tests with foundry

Message:  attempt to add with overflow
Location: /home/george/.cargo/registry/src/index.crates.io-6f17d22bba15001f/revm-interpreter-4.0.0/src/interpreter/shared_memory.rs:98

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮                               
   8: core::panicking::panic::h44790a89027c670f
      at <unknown source file>:<unknown line>
   9: revm_interpreter::instructions::control::revert::h42b8d8e64679ada4
      at <unknown source file>:<unknown line>
  10: revm::inspector::handler_register::inspector_instruction::{{closure}}::h1d34c1afe43f7f83
      at <unknown source file>:<unknown line>
  11: revm::evm::Evm<EXT,DB>::start_the_loop::h22480a9a2ae84bf9
      at <unknown source file>:<unknown line>
  12: revm::evm::Evm<EXT,DB>::transact_preverified_inner::hb7a7358a7d8cf414
      at <unknown source file>:<unknown line>

Proposed fix is to use saturating add to check if limit reached

@rakita rakita merged commit 05f3c5b into bluealloy:main May 17, 2024
25 checks passed
@github-actions github-actions bot mentioned this pull request May 17, 2024
@grandizzy grandizzy deleted the mem-limit-panic branch May 17, 2024 11:40
This was referenced May 17, 2024
This was referenced Jun 3, 2024
This was referenced Jun 11, 2024
@github-actions github-actions bot mentioned this pull request Jun 19, 2024
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

4 participants