File tree Expand file tree Collapse file tree
snapshots/cli/component-model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,9 @@ mod component_limits {
7272 pub const MAX_WASM_RECORD_FIELDS : usize = 10_000 ;
7373 pub const MAX_WASM_VARIANT_CASES : usize = 10_000 ;
7474 pub const MAX_WASM_TUPLE_TYPES : usize = 10_000 ;
75+ /// Fixed-length lists don't contribute their length to the component
76+ /// type-size budget, so the element count gets a separate limit of 1 Gi.
77+ pub const MAX_WASM_FIXED_LENGTH_LIST_ELEMENTS : usize = 1_073_741_824 ;
7578 pub const MAX_WASM_FLAG_NAMES : usize = 1_000 ;
7679 pub const MAX_WASM_ENUM_CASES : usize = 10_000 ;
7780 pub const MAX_WASM_INSTANTIATION_EXPORTS : usize = 100_000 ;
Original file line number Diff line number Diff line change @@ -4069,6 +4069,13 @@ impl ComponentState {
40694069 "Fixed-length lists must have more than zero elements"
40704070 )
40714071 }
4072+ check_max (
4073+ 0 ,
4074+ elements,
4075+ MAX_WASM_FIXED_LENGTH_LIST_ELEMENTS ,
4076+ "fixed-length list element" ,
4077+ offset,
4078+ ) ?;
40724079 Ok ( ComponentDefinedType :: FixedLengthList (
40734080 self . create_component_val_type ( ty, offset) ?,
40744081 elements,
Original file line number Diff line number Diff line change 3838 " Fixed-length lists must have more than zero elements (at offset 0x54)"
3939)
4040
41+ (assert_invalid
42+ (component
43+ (core module $m
44+ (memory (export " memory" ) 1 )
45+ (func (export " ret-list" ) (result i32 ) unreachable )
46+ )
47+ (core instance $i (instantiate $m ))
48+
49+ (func (export " ret-list" ) (result (list u32 4294967295 ))
50+ (canon lift (core func $i " ret-list" ) (memory $i " memory" ))
51+ )
52+ )
53+ " fixed-length list element count exceeds limit of 1073741824 (at offset 0x54)"
54+ )
55+
4156(assert_malformed
4257 (component quote
4358 " (core module $m"
Original file line number Diff line number Diff line change 2121 "text" : " Fixed-length lists must have more than zero elements (at offset 0x54)"
2222 },
2323 {
24- "type" : " assert_malformed " ,
24+ "type" : " assert_invalid " ,
2525 "line" : 42 ,
26- "filename" : " fixed-length-lists.3.wat" ,
26+ "filename" : " fixed-length-lists.3.wasm" ,
27+ "module_type" : " binary" ,
28+ "text" : " fixed-length list element count exceeds limit of 1073741824 (at offset 0x54)"
29+ },
30+ {
31+ "type" : " assert_malformed" ,
32+ "line" : 57 ,
33+ "filename" : " fixed-length-lists.4.wat" ,
2734 "module_type" : " text" ,
2835 "text" : " invalid u32 number: constant out of range"
2936 },
3037 {
3138 "type" : " assert_invalid" ,
32- "line" : 57 ,
33- "filename" : " fixed-length-lists.4 .wasm" ,
39+ "line" : 72 ,
40+ "filename" : " fixed-length-lists.5 .wasm" ,
3441 "module_type" : " binary" ,
3542 "text" : " type mismatch for import `x`"
3643 },
3744 {
3845 "type" : " assert_invalid" ,
39- "line" : 70 ,
40- "filename" : " fixed-length-lists.5 .wasm" ,
46+ "line" : 85 ,
47+ "filename" : " fixed-length-lists.6 .wasm" ,
4148 "module_type" : " binary" ,
4249 "text" : " type mismatch for import `x`"
4350 }
You can’t perform that action at this time.
0 commit comments