wasmtime-cli 45.0.0

Command-line interface for Wasmtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
;;! multi_memory = true
;;! hogs_memory = true

;; This is a test which exercises the various behaviors of sending massive
;; strings from one component to another. This ensures that all memory accesses
;; are bounds checked, for example. This additionally ensures that all maximal
;; widths of strings are respected.
;;
;; The test here is relatively carefully crafted to not actually need to create
;; massive strings at runtime. The goal here is to test what kind of trap
;; happens before any "real" transcoding happens. Transcoding of 1 or 2 bytes
;; should happen but eventually `realloc` will fail-fast before any real
;; transcoding. Memory growth is assumed to be VM-based and thus quite fast.
(component definition $A
  (component $A
    (core module $m
      (memory (export "m") 1)
      (global $allow (mut i32) (i32.const 0))
      (func (export "f") (param i32 i32) unreachable)
      (func (export "realloc") (param i32 i32 i32 i32) (result i32)
        (local $target-pages i32)
        ;; if realloc isn't allowed, then trap
        global.get $allow
        i32.eqz
        if unreachable end

        i32.const 0
        global.set $allow

        (local.set $target-pages
          (i32.shr_u
            (i32.add
              (local.get 3)
              (i32.const 65535))
            (i32.const 16)))

        (if (i32.lt_u (memory.size) (local.get $target-pages))
          (then
            (memory.grow (i32.sub (local.get $target-pages) (memory.size)))
            i32.const -1
            i32.eq
            if unreachable end
          )
        )

        i32.const 0
      )

      (func (export "allow-one-realloc")
        (global.set $allow (i32.const 1)))
    )
    (core instance $i (instantiate $m))
    (func (export "utf8") (param "x" string)
      (canon lift
        (core func $i "f")
        (memory $i "m")
        (realloc (func $i "realloc"))
        string-encoding=utf8
      )
    )
    (func (export "utf16") (param "x" string)
      (canon lift
        (core func $i "f")
        (memory $i "m")
        (realloc (func $i "realloc"))
        string-encoding=utf16
      )
    )
    (func (export "latin1-utf16") (param "x" string)
      (canon lift
        (core func $i "f")
        (memory $i "m")
        (realloc (func $i "realloc"))
        string-encoding=latin1+utf16
      )
    )

    (func (export "allow-one-realloc") (canon lift (core func $i "allow-one-realloc")))
  )
  (instance $a (instantiate $A))

  (component $B
    (import "a" (instance $a
      (export "utf8" (func (param "x" string)))
      (export "utf16" (func (param "x" string)))
      (export "latin1-utf16" (func (param "x" string)))
    ))

    (core module $libc (memory (export "mem") 1))
    (core instance $libc (instantiate $libc))
    (core func $utf8-utf8 (canon lower (func $a "utf8") string-encoding=utf8 (memory $libc "mem")))
    (core func $utf8-utf16 (canon lower (func $a "utf16") string-encoding=utf8 (memory $libc "mem")))
    (core func $utf8-latin1+utf16 (canon lower (func $a "latin1-utf16") string-encoding=utf8 (memory $libc "mem")))

    (core func $utf16-utf8 (canon lower (func $a "utf8") string-encoding=utf16 (memory $libc "mem")))
    (core func $utf16-utf16 (canon lower (func $a "utf16") string-encoding=utf16 (memory $libc "mem")))
    (core func $utf16-latin1+utf16 (canon lower (func $a "latin1-utf16") string-encoding=utf16 (memory $libc "mem")))

    (core func $latin1+utf16-utf8 (canon lower (func $a "utf8") string-encoding=latin1+utf16 (memory $libc "mem")))
    (core func $latin1+utf16-utf16 (canon lower (func $a "utf16") string-encoding=latin1+utf16 (memory $libc "mem")))
    (core func $latin1+utf16-latin1+utf16 (canon lower (func $a "latin1-utf16") string-encoding=latin1+utf16 (memory $libc "mem")))

    (core module $m
      (import "" "utf8-utf8" (func $utf8-utf8 (param i32 i32)))
      (import "" "utf8-utf16" (func $utf8-utf16 (param i32 i32)))
      (import "" "utf8-latin1+utf16" (func $utf8-latin1+utf16 (param i32 i32)))

      (import "" "utf16-utf8" (func $utf16-utf8 (param i32 i32)))
      (import "" "utf16-utf16" (func $utf16-utf16 (param i32 i32)))
      (import "" "utf16-latin1+utf16" (func $utf16-latin1+utf16 (param i32 i32)))

      (import "" "latin1+utf16-utf8" (func $latin1+utf16-utf8 (param i32 i32)))
      (import "" "latin1+utf16-utf16" (func $latin1+utf16-utf16 (param i32 i32)))
      (import "" "latin1+utf16-latin1+utf16" (func $latin1+utf16-latin1+utf16 (param i32 i32)))

      (import "" "mem" (memory 1))

      (func (export "utf8-utf8") (param i32)
        (call $utf8-utf8 (i32.const 0) (local.get 0)))
      (func (export "utf8-utf16") (param i32)
        (call $utf8-utf16 (i32.const 0) (local.get 0)))
      (func (export "utf8-latin1+utf16") (param i32)
        (call $utf8-latin1+utf16 (i32.const 0) (local.get 0)))

      (func (export "utf16-utf8") (param i32)
        (call $utf16-utf8 (i32.const 0) (local.get 0)))
      (func (export "utf16-utf16") (param i32)
        (call $utf16-utf16 (i32.const 0) (local.get 0)))
      (func (export "utf16-latin1+utf16") (param i32)
        (call $utf16-latin1+utf16 (i32.const 0) (local.get 0)))

      (func (export "latin1+utf16-utf8") (param i32)
        (call $latin1+utf16-utf8 (i32.const 0) (local.get 0)))
      (func (export "latin1+utf16-utf16") (param i32)
        (call $latin1+utf16-utf16 (i32.const 0) (local.get 0)))
      (func (export "latin1+utf16-latin1+utf16") (param i32)
        (call $latin1+utf16-latin1+utf16 (i32.const 0) (local.get 0)))

      (func (export "grow") (param i32) (result i32)
        (memory.grow (local.get 0)))
      (func (export "store8") (param i32 i32)
        (i32.store8 (local.get 0) (local.get 1)))
    )
    (core instance $i (instantiate $m
      (with "" (instance
        (export "utf8-utf8" (func $utf8-utf8))
        (export "utf8-utf16" (func $utf8-utf16))
        (export "utf8-latin1+utf16" (func $utf8-latin1+utf16))
        (export "utf16-utf8" (func $utf16-utf8))
        (export "utf16-utf16" (func $utf16-utf16))
        (export "utf16-latin1+utf16" (func $utf16-latin1+utf16))
        (export "latin1+utf16-utf8" (func $latin1+utf16-utf8))
        (export "latin1+utf16-utf16" (func $latin1+utf16-utf16))
        (export "latin1+utf16-latin1+utf16" (func $latin1+utf16-latin1+utf16))

        (export "mem" (memory $libc "mem"))
      ))
    ))

    (func (export "utf8-utf8") (param "x" u32) (canon lift (core func $i "utf8-utf8")))
    (func (export "utf8-utf16") (param "x" u32) (canon lift (core func $i "utf8-utf16")))
    (func (export "utf8-latin1-utf16") (param "x" u32) (canon lift (core func $i "utf8-latin1+utf16")))

    (func (export "utf16-utf8") (param "x" u32) (canon lift (core func $i "utf16-utf8")))
    (func (export "utf16-utf16") (param "x" u32) (canon lift (core func $i "utf16-utf16")))
    (func (export "utf16-latin1-utf16") (param "x" u32) (canon lift (core func $i "utf16-latin1+utf16")))

    (func (export "latin1-utf16-utf8") (param "x" u32) (canon lift (core func $i "latin1+utf16-utf8")))
    (func (export "latin1-utf16-utf16") (param "x" u32) (canon lift (core func $i "latin1+utf16-utf16")))
    (func (export "latin1-utf16-latin1-utf16") (param "x" u32) (canon lift (core func $i "latin1+utf16-latin1+utf16")))

    (func (export "grow") (param "x" u32) (result s32)
      (canon lift (core func $i "grow")))
    (func (export "store8") (param "addr" u32) (param "val" u8)
      (canon lift (core func $i "store8")))
  )
  (instance $b (instantiate $B (with "a" (instance $a))))

  (export "utf8-utf8" (func $b "utf8-utf8"))
  (export "utf8-utf16" (func $b "utf8-utf16"))
  (export "utf8-latin1-utf16" (func $b "utf8-latin1-utf16"))

  (export "utf16-utf8" (func $b "utf16-utf8"))
  (export "utf16-utf16" (func $b "utf16-utf16"))
  (export "utf16-latin1-utf16" (func $b "utf16-latin1-utf16"))

  (export "latin1-utf16-utf8" (func $b "latin1-utf16-utf8"))
  (export "latin1-utf16-utf16" (func $b "latin1-utf16-utf16"))
  (export "latin1-utf16-latin1-utf16" (func $b "latin1-utf16-latin1-utf16"))

  (export "grow" (func $b "grow"))
  (export "store8" (func $b "store8"))
  (export "allow-one-realloc" (func $a "allow-one-realloc"))
)


;; Test the 9 various permutations below. For each permutation there's a test
;; for the string flat-out being out-of-bounds, a test for a just in-bounds
;; string which hits `unreachable` in the realloc, and then a test for a just
;; out-of-bounds string.

;; utf8 -> utf8 -- can pass up to (1<<31)-1
(component instance $A $A)
(assert_trap (invoke "utf8-utf8" (u32.const 0x7fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-utf8" (u32.const 0x7fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-utf8" (u32.const 0x8000_0000)) "string content out-of-bounds")

;; utf8 -> utf16 -- worst case alloc up-front means that the maximum byte length
;; is half the prior case.
(component instance $A $A)
(assert_trap (invoke "utf8-utf16" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; utf8 -> latin1+utf16 -- initial utf8-string can't be too big
(component instance $A $A)
(assert_trap (invoke "utf8-latin1-utf16" (u32.const 0x7fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-latin1-utf16" (u32.const 0x7fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf8-latin1-utf16" (u32.const 0x8000_0000)) "string content out-of-bounds")

;; utf8 -> latin1+utf16 -- mid-transcode inflation to utf16 has limits on size
;; which only shows up on the second realloc.
;;
;; here `chr(0x100).encode('utf8') == "\xc4\x80"
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xc4)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x80)))
(assert_trap (invoke "utf8-latin1-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xc4)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x80)))
(assert_trap (invoke "utf8-latin1-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; utf16 -> utf8 -- if all utf16 code units become 1 utf16 byte then up to
;; (1<<30)-1 utf16 codepoints are allowed
(component instance $A $A)
(assert_trap (invoke "utf16-utf8" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-utf8" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-utf8" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; utf16 -> utf8 -- if a utf16 code unit becomes more than one utf8 byte then
;; ((1<<31)-1)/3 utf16 codepoints are allowed
;;
;; "ΓΏ" in utf16 is two bytes, "\xff\x00", and encodes as a multi-byte value in
;; utf8 which causes encoding to switch inflate the utf-8 buffer to the maximum
;; length. This means that a single realloc happens, a few bytes are transcoded,
;; and then a second realloc happens. The boundary around invoking this second
;; realloc and testing for too-large a string is what's tested here.
(component instance $A $A)
(assert_trap (invoke "utf16-utf8" (u32.const 715827882)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x00)))
(assert_trap (invoke "utf16-utf8" (u32.const 715827882)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x00)))
(assert_trap (invoke "utf16-utf8" (u32.const 715827883)) "string content out-of-bounds")

;; utf16 -> utf16 -- (1<<30)-1 utf16 codepoints are allowed
(component instance $A $A)
(assert_trap (invoke "utf16-utf16" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; utf16 -> latin1+utf16 -- initial utf16-string can't be too big
(component instance $A $A)
(assert_trap (invoke "utf16-latin1-utf16" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-latin1-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "utf16-latin1-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; utf16 -> latin1+utf16 -- mid-transcode inflation to utf16 has limits on size
;; which only shows up on the second realloc.
;;
;; here `chr(0x100).encode('utf-16-le') == "\x00\x01"
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0x00)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x01)))
(assert_trap (invoke "utf16-latin1-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0x00)))
(assert_return (invoke "store8" (u32.const 1) (u8.const 0x01)))
(assert_trap (invoke "utf16-latin1-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; latin1+utf16 -> utf8 / latin1 -> utf8 - if it's all single-byte utf8
;; characters there's no actual limit.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "unreachable")

;; latin1+utf16 -> utf8 / latin1 -> utf8 - with a multi-byte character there's
;; a size limit.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; latin1+utf16 -> utf8 / utf16 -> utf8 - if it's all single-byte utf8
;; characters there's no actual limit.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0x3fff_ffff)) "unreachable")

;; latin1+utf16 -> utf8 / utf16 -> utf8 - string can be too large just like
;; normal utf16 -> utf8 path.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xbfff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xbfff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xc000_0000)) "string content out-of-bounds")

;; latin1+utf16 -> utf8 / utf16 -> utf8 - with multi-byte characters we're
;; limited unlike the
;;
;; for more details see the utf16 -> utf8 case far above. Note that
;; `715827882 == 0x2aaaaaaa` and with the upper bit set that's 0xaaaaaaaa
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xaaaaaaaa)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xaaaaaaaa)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_return (invoke "allow-one-realloc"))
(assert_return (invoke "store8" (u32.const 0) (u8.const 0xff)))
(assert_trap (invoke "latin1-utf16-utf8" (u32.const 0xaaaaaaab)) "string content out-of-bounds")

;; latin1+utf16 -> utf16 / latin1 -> utf16 - simple inflation but the string
;; can be too big since it's doubling in byte size.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0x3fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0x3fff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0x4000_0000)) "string content out-of-bounds")

;; latin1+utf16 -> utf16 / utf16 -> utf16 - simple inflation, but string can be
;; too large.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0xbfff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0xbfff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-utf16" (u32.const 0xc000_0000)) "string content out-of-bounds")

;; latin1+utf16 -> latin1+utf16 - latin1 src is a simple copy with no limit.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-latin1-utf16" (u32.const 0x7fff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-latin1-utf16" (u32.const 0x7fff_ffff)) "unreachable")

;; latin1+utf16 -> latin1+utf16 - utf16 src means that the string can be
;; too large, so test that here.
(component instance $A $A)
(assert_trap (invoke "latin1-utf16-latin1-utf16" (u32.const 0xbfff_ffff)) "string content out-of-bounds")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-latin1-utf16" (u32.const 0xbfff_ffff)) "unreachable")
(component instance $A $A)
(assert_return (invoke "grow" (u32.const 65530)) (s32.const 1))
(assert_trap (invoke "latin1-utf16-latin1-utf16" (u32.const 0xc000_0000)) "string content out-of-bounds")