summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wasmparser/src/limits.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/wasmparser/src/limits.rs
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/wasmparser/src/limits.rs')
-rw-r--r--third_party/rust/wasmparser/src/limits.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/third_party/rust/wasmparser/src/limits.rs b/third_party/rust/wasmparser/src/limits.rs
new file mode 100644
index 0000000000..e9ab7d06a6
--- /dev/null
+++ b/third_party/rust/wasmparser/src/limits.rs
@@ -0,0 +1,57 @@
+/* Copyright 2017 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// The following limits are imposed by wasmparser on WebAssembly modules.
+// The limits are agreed upon with other engines for consistency.
+pub const MAX_WASM_TYPES: usize = 1_000_000;
+pub const MAX_WASM_FUNCTIONS: usize = 1_000_000;
+pub const MAX_WASM_EXPORTS: usize = 100_000;
+pub const MAX_WASM_GLOBALS: usize = 1_000_000;
+pub const MAX_WASM_ELEMENT_SEGMENTS: usize = 100_000;
+pub const MAX_WASM_DATA_SEGMENTS: usize = 100_000;
+pub const MAX_WASM_MEMORY32_PAGES: u64 = 65536;
+pub const MAX_WASM_MEMORY64_PAGES: u64 = 1 << 48;
+pub const MAX_WASM_STRING_SIZE: usize = 100_000;
+pub const MAX_WASM_FUNCTION_SIZE: usize = 128 * 1024;
+pub const MAX_WASM_FUNCTION_LOCALS: usize = 50000;
+pub const MAX_WASM_FUNCTION_PARAMS: usize = 1000;
+pub const MAX_WASM_FUNCTION_RETURNS: usize = 1000;
+pub const _MAX_WASM_TABLE_SIZE: usize = 10_000_000;
+pub const MAX_WASM_TABLE_ENTRIES: usize = 10_000_000;
+pub const MAX_WASM_TABLES: usize = 100;
+pub const MAX_WASM_MEMORIES: usize = 100;
+pub const MAX_WASM_TAGS: usize = 1_000_000;
+pub const MAX_WASM_BR_TABLE_SIZE: usize = MAX_WASM_FUNCTION_SIZE;
+
+// Component-related limits
+pub const MAX_WASM_MODULE_SIZE: usize = 1024 * 1024 * 1024; //= 1 GiB
+pub const MAX_WASM_MODULE_TYPE_DECLS: usize = 100_000;
+pub const MAX_WASM_COMPONENT_TYPE_DECLS: usize = 100_000;
+pub const MAX_WASM_INSTANCE_TYPE_DECLS: usize = 100_000;
+pub const MAX_WASM_RECORD_FIELDS: usize = 1000;
+pub const MAX_WASM_VARIANT_CASES: usize = 1000;
+pub const MAX_WASM_TUPLE_TYPES: usize = 1000;
+pub const MAX_WASM_FLAG_NAMES: usize = 1000;
+pub const MAX_WASM_ENUM_CASES: usize = 1000;
+pub const MAX_WASM_UNION_TYPES: usize = 1000;
+pub const MAX_WASM_INSTANTIATION_EXPORTS: usize = 1000;
+pub const MAX_WASM_CANONICAL_OPTIONS: usize = 10;
+pub const MAX_WASM_INSTANTIATION_ARGS: usize = 1000;
+pub const MAX_WASM_START_ARGS: usize = 1000;
+pub const MAX_WASM_TYPE_SIZE: u32 = 1_000_000;
+pub const MAX_WASM_MODULES: usize = 1_000;
+pub const MAX_WASM_COMPONENTS: usize = 1_000;
+pub const MAX_WASM_INSTANCES: usize = 1_000;
+pub const MAX_WASM_VALUES: usize = 1_000;