Skip to content

Fix overflows with memory of max size#809

Merged
gumb0 merged 3 commits intomasterfrom
only-memory-size-helper
Jan 13, 2022
Merged

Fix overflows with memory of max size#809
gumb0 merged 3 commits intomasterfrom
only-memory-size-helper

Conversation

@gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jan 10, 2022

The first part of max-memory-related fixes, fixing an overflow happening on both 32-bit and 64-bit.

// new_pages <= memory_pages_limit <= MaxMemoryPagesLimit guarantees memory_pages_to_bytes
// will not overflow uint32_t.
assert(new_pages * PageSize <= std::numeric_limits<uint32_t>::max());
assert(memory_pages_to_bytes(new_pages) <= std::numeric_limits<uint32_t>::max());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This assertion is fixed in follow-up PRs.

@gumb0 gumb0 requested review from axic and chfast January 10, 2022 12:04
@gumb0 gumb0 force-pushed the only-memory-size-helper branch from 267ddc0 to 20cb1a0 Compare January 10, 2022 16:44
@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #809 (20cb1a0) into master (95d5087) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #809   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files          80       81    +1     
  Lines       12812    12825   +13     
=======================================
+ Hits        12687    12700   +13     
  Misses        125      125           
Flag Coverage Δ
rust 99.90% <ø> (ø)
spectests 90.04% <66.66%> (-0.06%) ⬇️
unittests 98.95% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/fizzy/execute.cpp 99.29% <100.00%> (+<0.01%) ⬆️
lib/fizzy/instantiate.cpp 100.00% <100.00%> (ø)
lib/fizzy/limits.hpp 100.00% <100.00%> (ø)
test/unittests/instantiate_test.cpp 100.00% <100.00%> (ø)

@gumb0 gumb0 merged commit cab8a7b into master Jan 13, 2022
@gumb0 gumb0 deleted the only-memory-size-helper branch January 13, 2022 10:20
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