1;; unaligned utf16 string 2(assert_trap 3 (component 4 (component $c 5 (core module $m 6 (func (export "") (param i32 i32)) 7 (func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0) 8 (memory (export "memory") 1) 9 ) 10 (core instance $m (instantiate $m)) 11 (func (export "") (param string) 12 (canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")) 13 ) 14 ) 15 16 (component $c2 17 (import "" (func $f (param string))) 18 (core module $libc 19 (memory (export "memory") 1) 20 ) 21 (core instance $libc (instantiate $libc)) 22 (core func $f (canon lower (func $f) string-encoding=utf16 (memory $libc "memory"))) 23 (core module $m 24 (import "" "" (func $f (param i32 i32))) 25 26 (func $start (call $f (i32.const 1) (i32.const 0))) 27 (start $start) 28 ) 29 (core instance (instantiate $m (with "" (instance (export "" (func $f)))))) 30 ) 31 32 (instance $c (instantiate $c)) 33 (instance $c2 (instantiate $c2 (with "" (func $c "")))) 34 ) 35 "unreachable") 36 37;; unaligned latin1+utf16 string, even with the latin1 encoding 38(assert_trap 39 (component 40 (component $c 41 (core module $m 42 (func (export "") (param i32 i32)) 43 (func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0) 44 (memory (export "memory") 1) 45 ) 46 (core instance $m (instantiate $m)) 47 (func (export "") (param string) 48 (canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")) 49 ) 50 ) 51 52 (component $c2 53 (import "" (func $f (param string))) 54 (core module $libc 55 (memory (export "memory") 1) 56 ) 57 (core instance $libc (instantiate $libc)) 58 (core func $f (canon lower (func $f) string-encoding=latin1+utf16 (memory $libc "memory"))) 59 (core module $m 60 (import "" "" (func $f (param i32 i32))) 61 62 (func $start (call $f (i32.const 1) (i32.const 0))) 63 (start $start) 64 ) 65 (core instance (instantiate $m (with "" (instance (export "" (func $f)))))) 66 ) 67 68 (instance $c (instantiate $c)) 69 (instance $c2 (instantiate $c2 (with "" (func $c "")))) 70 ) 71 "unreachable") 72 73;; out of bounds utf8->utf8 string 74(assert_trap 75 (component 76 (component $c 77 (core module $m 78 (func (export "") (param i32 i32)) 79 (func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0) 80 (memory (export "memory") 1) 81 ) 82 (core instance $m (instantiate $m)) 83 (func (export "") (param string) 84 (canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory") 85 string-encoding=utf8) 86 ) 87 ) 88 89 (component $c2 90 (import "" (func $f (param string))) 91 (core module $libc 92 (memory (export "memory") 1) 93 ) 94 (core instance $libc (instantiate $libc)) 95 (core func $f (canon lower (func $f) string-encoding=utf8 (memory $libc "memory"))) 96 (core module $m 97 (import "" "" (func $f (param i32 i32))) 98 99 (func $start (call $f (i32.const 0x8000_0000) (i32.const 1))) 100 (start $start) 101 ) 102 (core instance (instantiate $m (with "" (instance (export "" (func $f)))))) 103 ) 104 105 (instance $c (instantiate $c)) 106 (instance $c2 (instantiate $c2 (with "" (func $c "")))) 107 ) 108 "unreachable") 109