Files
wasmtime/tests/misc_testsuite/component-model/strings.wast
Alex Crichton 29c7de7340 Update wasm-tools dependencies (#4970)
* Update wasm-tools dependencies

This update brings in a number of features such as:

* The component model binary format and AST has been slightly adjusted
  in a few locations. Names are dropped from parameters/results now in
  the internal representation since they were not used anyway. At this
  time the ability to bind a multi-return function has not been exposed.

* The `wasmparser` validator pass will now share allocations with prior
  functions, providing what's probably a very minor speedup for Wasmtime
  itself.

* The text format for many component-related tests now requires named
  parameters.

* Some new relaxed-simd instructions are updated to be ignored.

I hope to have a follow-up to expose the multi-return ability to the
embedding API of components.

* Update audit information for new crates
2022-09-27 13:12:34 -05:00

109 lines
3.3 KiB
Plaintext

;; unaligned utf16 string
(assert_trap
(component
(component $c
(core module $m
(func (export "") (param i32 i32))
(func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0)
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory"))
)
)
(component $c2
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
(core instance $libc (instantiate $libc))
(core func $f (canon lower (func $f) string-encoding=utf16 (memory $libc "memory")))
(core module $m
(import "" "" (func $f (param i32 i32)))
(func $start (call $f (i32.const 1) (i32.const 0)))
(start $start)
)
(core instance (instantiate $m (with "" (instance (export "" (func $f))))))
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
)
"unreachable")
;; unaligned latin1+utf16 string, even with the latin1 encoding
(assert_trap
(component
(component $c
(core module $m
(func (export "") (param i32 i32))
(func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0)
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory"))
)
)
(component $c2
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
(core instance $libc (instantiate $libc))
(core func $f (canon lower (func $f) string-encoding=latin1+utf16 (memory $libc "memory")))
(core module $m
(import "" "" (func $f (param i32 i32)))
(func $start (call $f (i32.const 1) (i32.const 0)))
(start $start)
)
(core instance (instantiate $m (with "" (instance (export "" (func $f))))))
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
)
"unreachable")
;; out of bounds utf8->utf8 string
(assert_trap
(component
(component $c
(core module $m
(func (export "") (param i32 i32))
(func (export "realloc") (param i32 i32 i32 i32) (result i32) i32.const 0)
(memory (export "memory") 1)
)
(core instance $m (instantiate $m))
(func (export "") (param "a" string)
(canon lift (core func $m "") (realloc (func $m "realloc")) (memory $m "memory")
string-encoding=utf8)
)
)
(component $c2
(import "" (func $f (param "a" string)))
(core module $libc
(memory (export "memory") 1)
)
(core instance $libc (instantiate $libc))
(core func $f (canon lower (func $f) string-encoding=utf8 (memory $libc "memory")))
(core module $m
(import "" "" (func $f (param i32 i32)))
(func $start (call $f (i32.const 0x8000_0000) (i32.const 1)))
(start $start)
)
(core instance (instantiate $m (with "" (instance (export "" (func $f))))))
)
(instance $c (instantiate $c))
(instance $c2 (instantiate $c2 (with "" (func $c ""))))
)
"unreachable")