limits-br-table.js (634B)
1 let maxBrTableElems = 65520; 2 3 // br_table with max labels on it. Only one of them is the correct target 4 let {test} = wasmEvalText(` 5 (func (export "test") (result i32) 6 (block $t 7 (block $f 8 (br_table 9 $t 10 ${"$f ".repeat(maxBrTableElems - 1)} 11 $f 12 (i32.const 0) 13 ) 14 ) 15 i32.const 0 16 return 17 ) 18 i32.const 1 19 ) 20 `).exports; 21 assertEq(test(), 1); 22 23 wasmFailValidateText(` 24 (func 25 (block $l 26 (br_table 27 ${"$l ".repeat(maxBrTableElems + 1)} 28 $l 29 (i32.const 0) 30 ) 31 ) 32 ) 33 `, /br_table too big/);