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: saturate memory offset taken from stack #950

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

enitrat
Copy link
Collaborator

@enitrat enitrat commented Sep 16, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Resolves: #

What is the new behavior?

  • In some cases, it was possible that a memory offset taken from the stack was absurdely high, but combined with a null size. In this case, since no memory was modified, no gas was charged for that, and the memory was not resized
  • This ensures that, for these high values, the program doesn't fail with a type execution error - rather, we saturate at the max_usize value, s.t. if size != 0, the memory expansion will create a failure because of a too high cost - and otherwise, the tx will pass.

Does this introduce a breaking change?

  • Yes
  • No

This change is Reviewable

@enitrat
Copy link
Collaborator Author

enitrat commented Sep 17, 2024

Failing test will be solved upon rebasing on #949

obatirou
obatirou previously approved these changes Sep 17, 2024
@enitrat enitrat merged commit fed4554 into main Sep 17, 2024
4 checks passed
@enitrat enitrat deleted the fix/saturate-memory-offsets branch September 17, 2024 14:01
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