mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWasm: Use the number of bytes when comparing memory limits
...instead of comparing page count with byte count.
This commit is contained in:
parent
4bdb0ad132
commit
0b08392e54
Notes:
sideshowbarker
2024-07-18 10:18:36 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/0b08392e541 Pull-request: https://github.com/SerenityOS/serenity/pull/8488
@ -350,8 +350,10 @@ public:
|
||||
if (size_to_grow == 0)
|
||||
return true;
|
||||
auto new_size = m_data.size() + size_to_grow;
|
||||
if (m_type.limits().max().value_or(new_size) < new_size)
|
||||
return false;
|
||||
if (auto max = m_type.limits().max(); max.has_value()) {
|
||||
if (max.value() * Constants::page_size < new_size)
|
||||
return false;
|
||||
}
|
||||
auto previous_size = m_size;
|
||||
m_data.resize(new_size);
|
||||
m_size = new_size;
|
||||
|
Loading…
Reference in New Issue
Block a user