mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 18:46:03 +00:00
LibWasm: Move the vector size limit to Constants.h and increase it a bit
This commit is contained in:
parent
566c5d1e99
commit
d52a26de3f
Notes:
sideshowbarker
2024-07-18 04:44:07 +09:00
Author: https://github.com/alimpfard
Commit: d52a26de3f
Pull-request: https://github.com/SerenityOS/serenity/pull/9795
Reviewed-by: https://github.com/linusg ✅
2 changed files with 2 additions and 1 deletions
|
@ -40,6 +40,7 @@ static constexpr auto page_size = 64 * KiB;
|
|||
// These are not concretely defined by the spec, so the values are only defined by us.
|
||||
static constexpr auto minimum_stack_space_to_keep_free = 256 * KiB; // Note: Value is arbitrary and chosen by testing with ASAN
|
||||
static constexpr auto max_allowed_executed_instructions_per_call = 256 * 1024 * 1024;
|
||||
static constexpr auto max_allowed_vector_size = 2 * MiB;
|
||||
static constexpr auto max_allowed_function_locals_per_type = 420; // Note: VERY arbitrary.
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static auto parse_vector(InputStream& stream)
|
|||
return ParseResult<Vector<T>> { with_eof_check(stream, ParseError::ExpectedSize) };
|
||||
entries.append(value);
|
||||
} else if constexpr (IsSame<T, u8>) {
|
||||
if (count > 64 * KiB)
|
||||
if (count > Constants::max_allowed_vector_size)
|
||||
return ParseResult<Vector<T>> { ParseError::HugeAllocationRequested };
|
||||
entries.resize(count);
|
||||
if (!stream.read_or_error({ entries.data(), entries.size() }))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue