...
1;;;;;; Invalid UTF-8 import module names
2
3;;;; Continuation bytes not preceded by prefixes
4
5;; encoding starts with (first) continuation byte
6(assert_malformed
7 (module binary
8 "\00asm" "\01\00\00\00"
9 "\02\0b" ;; import section
10 "\01" ;; length 1
11 "\04\74\65\73\74" ;; "test"
12 "\01\80" ;; "\80"
13 "\03" ;; GlobalImport
14 "\7f" ;; i32
15 "\00" ;; immutable
16 )
17 "invalid UTF-8 encoding"
18)
19
20;; encoding starts with (0x8f) continuation byte
21(assert_malformed
22 (module binary
23 "\00asm" "\01\00\00\00"
24 "\02\0b" ;; import section
25 "\01" ;; length 1
26 "\04\74\65\73\74" ;; "test"
27 "\01\8f" ;; "\8f"
28 "\03" ;; GlobalImport
29 "\7f" ;; i32
30 "\00" ;; immutable
31 )
32 "invalid UTF-8 encoding"
33)
34
35;; encoding starts with (0x90) continuation byte
36(assert_malformed
37 (module binary
38 "\00asm" "\01\00\00\00"
39 "\02\0b" ;; import section
40 "\01" ;; length 1
41 "\04\74\65\73\74" ;; "test"
42 "\01\90" ;; "\90"
43 "\03" ;; GlobalImport
44 "\7f" ;; i32
45 "\00" ;; immutable
46 )
47 "invalid UTF-8 encoding"
48)
49
50;; encoding starts with (0x9f) continuation byte
51(assert_malformed
52 (module binary
53 "\00asm" "\01\00\00\00"
54 "\02\0b" ;; import section
55 "\01" ;; length 1
56 "\04\74\65\73\74" ;; "test"
57 "\01\9f" ;; "\9f"
58 "\03" ;; GlobalImport
59 "\7f" ;; i32
60 "\00" ;; immutable
61 )
62 "invalid UTF-8 encoding"
63)
64
65;; encoding starts with (0xa0) continuation byte
66(assert_malformed
67 (module binary
68 "\00asm" "\01\00\00\00"
69 "\02\0b" ;; import section
70 "\01" ;; length 1
71 "\04\74\65\73\74" ;; "test"
72 "\01\a0" ;; "\a0"
73 "\03" ;; GlobalImport
74 "\7f" ;; i32
75 "\00" ;; immutable
76 )
77 "invalid UTF-8 encoding"
78)
79
80;; encoding starts with (last) continuation byte
81(assert_malformed
82 (module binary
83 "\00asm" "\01\00\00\00"
84 "\02\0b" ;; import section
85 "\01" ;; length 1
86 "\04\74\65\73\74" ;; "test"
87 "\01\bf" ;; "\bf"
88 "\03" ;; GlobalImport
89 "\7f" ;; i32
90 "\00" ;; immutable
91 )
92 "invalid UTF-8 encoding"
93)
94
95;;;; 2-byte sequences
96
97;; 2-byte sequence contains 3 bytes
98(assert_malformed
99 (module binary
100 "\00asm" "\01\00\00\00"
101 "\02\0d" ;; import section
102 "\01" ;; length 1
103 "\04\74\65\73\74" ;; "test"
104 "\03\c2\80\80" ;; "\c2\80\80"
105 "\03" ;; GlobalImport
106 "\7f" ;; i32
107 "\00" ;; immutable
108 )
109 "invalid UTF-8 encoding"
110)
111
112;; 2-byte sequence contains 1 byte at end of string
113(assert_malformed
114 (module binary
115 "\00asm" "\01\00\00\00"
116 "\02\0b" ;; import section
117 "\01" ;; length 1
118 "\04\74\65\73\74" ;; "test"
119 "\01\c2" ;; "\c2"
120 "\03" ;; GlobalImport
121 "\7f" ;; i32
122 "\00" ;; immutable
123 )
124 "invalid UTF-8 encoding"
125)
126
127;; 2-byte sequence contains 1 byte
128(assert_malformed
129 (module binary
130 "\00asm" "\01\00\00\00"
131 "\02\0c" ;; import section
132 "\01" ;; length 1
133 "\04\74\65\73\74" ;; "test"
134 "\02\c2\2e" ;; "\c2."
135 "\03" ;; GlobalImport
136 "\7f" ;; i32
137 "\00" ;; immutable
138 )
139 "invalid UTF-8 encoding"
140)
141
142;;;; 2-byte sequence contents
143
144;; overlong encoding after 0xc0 prefix
145(assert_malformed
146 (module binary
147 "\00asm" "\01\00\00\00"
148 "\02\0c" ;; import section
149 "\01" ;; length 1
150 "\04\74\65\73\74" ;; "test"
151 "\02\c0\80" ;; "\c0\80"
152 "\03" ;; GlobalImport
153 "\7f" ;; i32
154 "\00" ;; immutable
155 )
156 "invalid UTF-8 encoding"
157)
158
159;; overlong encoding after 0xc0 prefix
160(assert_malformed
161 (module binary
162 "\00asm" "\01\00\00\00"
163 "\02\0c" ;; import section
164 "\01" ;; length 1
165 "\04\74\65\73\74" ;; "test"
166 "\02\c0\bf" ;; "\c0\bf"
167 "\03" ;; GlobalImport
168 "\7f" ;; i32
169 "\00" ;; immutable
170 )
171 "invalid UTF-8 encoding"
172)
173
174;; overlong encoding after 0xc1 prefix
175(assert_malformed
176 (module binary
177 "\00asm" "\01\00\00\00"
178 "\02\0c" ;; import section
179 "\01" ;; length 1
180 "\04\74\65\73\74" ;; "test"
181 "\02\c1\80" ;; "\c1\80"
182 "\03" ;; GlobalImport
183 "\7f" ;; i32
184 "\00" ;; immutable
185 )
186 "invalid UTF-8 encoding"
187)
188
189;; overlong encoding after 0xc1 prefix
190(assert_malformed
191 (module binary
192 "\00asm" "\01\00\00\00"
193 "\02\0c" ;; import section
194 "\01" ;; length 1
195 "\04\74\65\73\74" ;; "test"
196 "\02\c1\bf" ;; "\c1\bf"
197 "\03" ;; GlobalImport
198 "\7f" ;; i32
199 "\00" ;; immutable
200 )
201 "invalid UTF-8 encoding"
202)
203
204;; byte after (first) 2-byte prefix not a contination byte
205(assert_malformed
206 (module binary
207 "\00asm" "\01\00\00\00"
208 "\02\0c" ;; import section
209 "\01" ;; length 1
210 "\04\74\65\73\74" ;; "test"
211 "\02\c2\00" ;; "\c2\00"
212 "\03" ;; GlobalImport
213 "\7f" ;; i32
214 "\00" ;; immutable
215 )
216 "invalid UTF-8 encoding"
217)
218
219;; byte after (first) 2-byte prefix not a continuation byte
220(assert_malformed
221 (module binary
222 "\00asm" "\01\00\00\00"
223 "\02\0c" ;; import section
224 "\01" ;; length 1
225 "\04\74\65\73\74" ;; "test"
226 "\02\c2\7f" ;; "\c2\7f"
227 "\03" ;; GlobalImport
228 "\7f" ;; i32
229 "\00" ;; immutable
230 )
231 "invalid UTF-8 encoding"
232)
233
234;; byte after (first) 2-byte prefix not a continuation byte
235(assert_malformed
236 (module binary
237 "\00asm" "\01\00\00\00"
238 "\02\0c" ;; import section
239 "\01" ;; length 1
240 "\04\74\65\73\74" ;; "test"
241 "\02\c2\c0" ;; "\c2\c0"
242 "\03" ;; GlobalImport
243 "\7f" ;; i32
244 "\00" ;; immutable
245 )
246 "invalid UTF-8 encoding"
247)
248
249;; byte after (first) 2-byte prefix not a continuation byte
250(assert_malformed
251 (module binary
252 "\00asm" "\01\00\00\00"
253 "\02\0c" ;; import section
254 "\01" ;; length 1
255 "\04\74\65\73\74" ;; "test"
256 "\02\c2\fd" ;; "\c2\fd"
257 "\03" ;; GlobalImport
258 "\7f" ;; i32
259 "\00" ;; immutable
260 )
261 "invalid UTF-8 encoding"
262)
263
264;; byte after (last) 2-byte prefix not a continuation byte
265(assert_malformed
266 (module binary
267 "\00asm" "\01\00\00\00"
268 "\02\0c" ;; import section
269 "\01" ;; length 1
270 "\04\74\65\73\74" ;; "test"
271 "\02\df\00" ;; "\df\00"
272 "\03" ;; GlobalImport
273 "\7f" ;; i32
274 "\00" ;; immutable
275 )
276 "invalid UTF-8 encoding"
277)
278
279;; byte after (last) 2-byte prefix not a continuation byte
280(assert_malformed
281 (module binary
282 "\00asm" "\01\00\00\00"
283 "\02\0c" ;; import section
284 "\01" ;; length 1
285 "\04\74\65\73\74" ;; "test"
286 "\02\df\7f" ;; "\df\7f"
287 "\03" ;; GlobalImport
288 "\7f" ;; i32
289 "\00" ;; immutable
290 )
291 "invalid UTF-8 encoding"
292)
293
294;; byte after (last) 2-byte prefix not a continuation byte
295(assert_malformed
296 (module binary
297 "\00asm" "\01\00\00\00"
298 "\02\0c" ;; import section
299 "\01" ;; length 1
300 "\04\74\65\73\74" ;; "test"
301 "\02\df\c0" ;; "\df\c0"
302 "\03" ;; GlobalImport
303 "\7f" ;; i32
304 "\00" ;; immutable
305 )
306 "invalid UTF-8 encoding"
307)
308
309;; byte after (last) 2-byte prefix not a continuation byte
310(assert_malformed
311 (module binary
312 "\00asm" "\01\00\00\00"
313 "\02\0c" ;; import section
314 "\01" ;; length 1
315 "\04\74\65\73\74" ;; "test"
316 "\02\df\fd" ;; "\df\fd"
317 "\03" ;; GlobalImport
318 "\7f" ;; i32
319 "\00" ;; immutable
320 )
321 "invalid UTF-8 encoding"
322)
323
324;;;; 3-byte sequences
325
326;; 3-byte sequence contains 4 bytes
327(assert_malformed
328 (module binary
329 "\00asm" "\01\00\00\00"
330 "\02\0e" ;; import section
331 "\01" ;; length 1
332 "\04\74\65\73\74" ;; "test"
333 "\04\e1\80\80\80" ;; "\e1\80\80\80"
334 "\03" ;; GlobalImport
335 "\7f" ;; i32
336 "\00" ;; immutable
337 )
338 "invalid UTF-8 encoding"
339)
340
341;; 3-byte sequence contains 2 bytes at end of string
342(assert_malformed
343 (module binary
344 "\00asm" "\01\00\00\00"
345 "\02\0c" ;; import section
346 "\01" ;; length 1
347 "\04\74\65\73\74" ;; "test"
348 "\02\e1\80" ;; "\e1\80"
349 "\03" ;; GlobalImport
350 "\7f" ;; i32
351 "\00" ;; immutable
352 )
353 "invalid UTF-8 encoding"
354)
355
356;; 3-byte sequence contains 2 bytes
357(assert_malformed
358 (module binary
359 "\00asm" "\01\00\00\00"
360 "\02\0d" ;; import section
361 "\01" ;; length 1
362 "\04\74\65\73\74" ;; "test"
363 "\03\e1\80\2e" ;; "\e1\80."
364 "\03" ;; GlobalImport
365 "\7f" ;; i32
366 "\00" ;; immutable
367 )
368 "invalid UTF-8 encoding"
369)
370
371;; 3-byte sequence contains 1 byte at end of string
372(assert_malformed
373 (module binary
374 "\00asm" "\01\00\00\00"
375 "\02\0b" ;; import section
376 "\01" ;; length 1
377 "\04\74\65\73\74" ;; "test"
378 "\01\e1" ;; "\e1"
379 "\03" ;; GlobalImport
380 "\7f" ;; i32
381 "\00" ;; immutable
382 )
383 "invalid UTF-8 encoding"
384)
385
386;; 3-byte sequence contains 1 byte
387(assert_malformed
388 (module binary
389 "\00asm" "\01\00\00\00"
390 "\02\0c" ;; import section
391 "\01" ;; length 1
392 "\04\74\65\73\74" ;; "test"
393 "\02\e1\2e" ;; "\e1."
394 "\03" ;; GlobalImport
395 "\7f" ;; i32
396 "\00" ;; immutable
397 )
398 "invalid UTF-8 encoding"
399)
400
401;;;; 3-byte sequence contents
402
403;; first byte after (0xe0) 3-byte prefix not a continuation byte
404(assert_malformed
405 (module binary
406 "\00asm" "\01\00\00\00"
407 "\02\0d" ;; import section
408 "\01" ;; length 1
409 "\04\74\65\73\74" ;; "test"
410 "\03\e0\00\a0" ;; "\e0\00\a0"
411 "\03" ;; GlobalImport
412 "\7f" ;; i32
413 "\00" ;; immutable
414 )
415 "invalid UTF-8 encoding"
416)
417
418;; first byte after (0xe0) 3-byte prefix not a continuation byte
419(assert_malformed
420 (module binary
421 "\00asm" "\01\00\00\00"
422 "\02\0d" ;; import section
423 "\01" ;; length 1
424 "\04\74\65\73\74" ;; "test"
425 "\03\e0\7f\a0" ;; "\e0\7f\a0"
426 "\03" ;; GlobalImport
427 "\7f" ;; i32
428 "\00" ;; immutable
429 )
430 "invalid UTF-8 encoding"
431)
432
433;; overlong encoding after 0xe0 prefix
434(assert_malformed
435 (module binary
436 "\00asm" "\01\00\00\00"
437 "\02\0d" ;; import section
438 "\01" ;; length 1
439 "\04\74\65\73\74" ;; "test"
440 "\03\e0\80\80" ;; "\e0\80\80"
441 "\03" ;; GlobalImport
442 "\7f" ;; i32
443 "\00" ;; immutable
444 )
445 "invalid UTF-8 encoding"
446)
447
448;; overlong encoding after 0xe0 prefix
449(assert_malformed
450 (module binary
451 "\00asm" "\01\00\00\00"
452 "\02\0d" ;; import section
453 "\01" ;; length 1
454 "\04\74\65\73\74" ;; "test"
455 "\03\e0\80\a0" ;; "\e0\80\a0"
456 "\03" ;; GlobalImport
457 "\7f" ;; i32
458 "\00" ;; immutable
459 )
460 "invalid UTF-8 encoding"
461)
462
463;; overlong encoding after 0xe0 prefix
464(assert_malformed
465 (module binary
466 "\00asm" "\01\00\00\00"
467 "\02\0d" ;; import section
468 "\01" ;; length 1
469 "\04\74\65\73\74" ;; "test"
470 "\03\e0\9f\a0" ;; "\e0\9f\a0"
471 "\03" ;; GlobalImport
472 "\7f" ;; i32
473 "\00" ;; immutable
474 )
475 "invalid UTF-8 encoding"
476)
477
478;; overlong encoding after 0xe0 prefix
479(assert_malformed
480 (module binary
481 "\00asm" "\01\00\00\00"
482 "\02\0d" ;; import section
483 "\01" ;; length 1
484 "\04\74\65\73\74" ;; "test"
485 "\03\e0\9f\bf" ;; "\e0\9f\bf"
486 "\03" ;; GlobalImport
487 "\7f" ;; i32
488 "\00" ;; immutable
489 )
490 "invalid UTF-8 encoding"
491)
492
493;; first byte after (0xe0) 3-byte prefix not a continuation byte
494(assert_malformed
495 (module binary
496 "\00asm" "\01\00\00\00"
497 "\02\0d" ;; import section
498 "\01" ;; length 1
499 "\04\74\65\73\74" ;; "test"
500 "\03\e0\c0\a0" ;; "\e0\c0\a0"
501 "\03" ;; GlobalImport
502 "\7f" ;; i32
503 "\00" ;; immutable
504 )
505 "invalid UTF-8 encoding"
506)
507
508;; first byte after (0xe0) 3-byte prefix not a continuation byte
509(assert_malformed
510 (module binary
511 "\00asm" "\01\00\00\00"
512 "\02\0d" ;; import section
513 "\01" ;; length 1
514 "\04\74\65\73\74" ;; "test"
515 "\03\e0\fd\a0" ;; "\e0\fd\a0"
516 "\03" ;; GlobalImport
517 "\7f" ;; i32
518 "\00" ;; immutable
519 )
520 "invalid UTF-8 encoding"
521)
522
523;; first byte after (first normal) 3-byte prefix not a continuation byte
524(assert_malformed
525 (module binary
526 "\00asm" "\01\00\00\00"
527 "\02\0d" ;; import section
528 "\01" ;; length 1
529 "\04\74\65\73\74" ;; "test"
530 "\03\e1\00\80" ;; "\e1\00\80"
531 "\03" ;; GlobalImport
532 "\7f" ;; i32
533 "\00" ;; immutable
534 )
535 "invalid UTF-8 encoding"
536)
537
538;; first byte after (first normal) 3-byte prefix not a continuation byte
539(assert_malformed
540 (module binary
541 "\00asm" "\01\00\00\00"
542 "\02\0d" ;; import section
543 "\01" ;; length 1
544 "\04\74\65\73\74" ;; "test"
545 "\03\e1\7f\80" ;; "\e1\7f\80"
546 "\03" ;; GlobalImport
547 "\7f" ;; i32
548 "\00" ;; immutable
549 )
550 "invalid UTF-8 encoding"
551)
552
553;; first byte after (first normal) 3-byte prefix not a continuation byte
554(assert_malformed
555 (module binary
556 "\00asm" "\01\00\00\00"
557 "\02\0d" ;; import section
558 "\01" ;; length 1
559 "\04\74\65\73\74" ;; "test"
560 "\03\e1\c0\80" ;; "\e1\c0\80"
561 "\03" ;; GlobalImport
562 "\7f" ;; i32
563 "\00" ;; immutable
564 )
565 "invalid UTF-8 encoding"
566)
567
568;; first byte after (first normal) 3-byte prefix not a continuation byte
569(assert_malformed
570 (module binary
571 "\00asm" "\01\00\00\00"
572 "\02\0d" ;; import section
573 "\01" ;; length 1
574 "\04\74\65\73\74" ;; "test"
575 "\03\e1\fd\80" ;; "\e1\fd\80"
576 "\03" ;; GlobalImport
577 "\7f" ;; i32
578 "\00" ;; immutable
579 )
580 "invalid UTF-8 encoding"
581)
582
583;; first byte after (normal) 3-byte prefix not a continuation byte
584(assert_malformed
585 (module binary
586 "\00asm" "\01\00\00\00"
587 "\02\0d" ;; import section
588 "\01" ;; length 1
589 "\04\74\65\73\74" ;; "test"
590 "\03\ec\00\80" ;; "\ec\00\80"
591 "\03" ;; GlobalImport
592 "\7f" ;; i32
593 "\00" ;; immutable
594 )
595 "invalid UTF-8 encoding"
596)
597
598;; first byte after (normal) 3-byte prefix not a continuation byte
599(assert_malformed
600 (module binary
601 "\00asm" "\01\00\00\00"
602 "\02\0d" ;; import section
603 "\01" ;; length 1
604 "\04\74\65\73\74" ;; "test"
605 "\03\ec\7f\80" ;; "\ec\7f\80"
606 "\03" ;; GlobalImport
607 "\7f" ;; i32
608 "\00" ;; immutable
609 )
610 "invalid UTF-8 encoding"
611)
612
613;; first byte after (normal) 3-byte prefix not a continuation byte
614(assert_malformed
615 (module binary
616 "\00asm" "\01\00\00\00"
617 "\02\0d" ;; import section
618 "\01" ;; length 1
619 "\04\74\65\73\74" ;; "test"
620 "\03\ec\c0\80" ;; "\ec\c0\80"
621 "\03" ;; GlobalImport
622 "\7f" ;; i32
623 "\00" ;; immutable
624 )
625 "invalid UTF-8 encoding"
626)
627
628;; first byte after (normal) 3-byte prefix not a continuation byte
629(assert_malformed
630 (module binary
631 "\00asm" "\01\00\00\00"
632 "\02\0d" ;; import section
633 "\01" ;; length 1
634 "\04\74\65\73\74" ;; "test"
635 "\03\ec\fd\80" ;; "\ec\fd\80"
636 "\03" ;; GlobalImport
637 "\7f" ;; i32
638 "\00" ;; immutable
639 )
640 "invalid UTF-8 encoding"
641)
642
643;; first byte after (0xed) 3-byte prefix not a continuation byte
644(assert_malformed
645 (module binary
646 "\00asm" "\01\00\00\00"
647 "\02\0d" ;; import section
648 "\01" ;; length 1
649 "\04\74\65\73\74" ;; "test"
650 "\03\ed\00\80" ;; "\ed\00\80"
651 "\03" ;; GlobalImport
652 "\7f" ;; i32
653 "\00" ;; immutable
654 )
655 "invalid UTF-8 encoding"
656)
657
658;; first byte after (0xed) 3-byte prefix not a continuation byte
659(assert_malformed
660 (module binary
661 "\00asm" "\01\00\00\00"
662 "\02\0d" ;; import section
663 "\01" ;; length 1
664 "\04\74\65\73\74" ;; "test"
665 "\03\ed\7f\80" ;; "\ed\7f\80"
666 "\03" ;; GlobalImport
667 "\7f" ;; i32
668 "\00" ;; immutable
669 )
670 "invalid UTF-8 encoding"
671)
672
673;; byte sequence reserved for UTF-16 surrogate half
674(assert_malformed
675 (module binary
676 "\00asm" "\01\00\00\00"
677 "\02\0d" ;; import section
678 "\01" ;; length 1
679 "\04\74\65\73\74" ;; "test"
680 "\03\ed\a0\80" ;; "\ed\a0\80"
681 "\03" ;; GlobalImport
682 "\7f" ;; i32
683 "\00" ;; immutable
684 )
685 "invalid UTF-8 encoding"
686)
687
688;; byte sequence reserved for UTF-16 surrogate half
689(assert_malformed
690 (module binary
691 "\00asm" "\01\00\00\00"
692 "\02\0d" ;; import section
693 "\01" ;; length 1
694 "\04\74\65\73\74" ;; "test"
695 "\03\ed\a0\bf" ;; "\ed\a0\bf"
696 "\03" ;; GlobalImport
697 "\7f" ;; i32
698 "\00" ;; immutable
699 )
700 "invalid UTF-8 encoding"
701)
702
703;; byte sequence reserved for UTF-16 surrogate half
704(assert_malformed
705 (module binary
706 "\00asm" "\01\00\00\00"
707 "\02\0d" ;; import section
708 "\01" ;; length 1
709 "\04\74\65\73\74" ;; "test"
710 "\03\ed\bf\80" ;; "\ed\bf\80"
711 "\03" ;; GlobalImport
712 "\7f" ;; i32
713 "\00" ;; immutable
714 )
715 "invalid UTF-8 encoding"
716)
717
718;; byte sequence reserved for UTF-16 surrogate half
719(assert_malformed
720 (module binary
721 "\00asm" "\01\00\00\00"
722 "\02\0d" ;; import section
723 "\01" ;; length 1
724 "\04\74\65\73\74" ;; "test"
725 "\03\ed\bf\bf" ;; "\ed\bf\bf"
726 "\03" ;; GlobalImport
727 "\7f" ;; i32
728 "\00" ;; immutable
729 )
730 "invalid UTF-8 encoding"
731)
732
733;; first byte after (0xed) 3-byte prefix not a continuation byte
734(assert_malformed
735 (module binary
736 "\00asm" "\01\00\00\00"
737 "\02\0d" ;; import section
738 "\01" ;; length 1
739 "\04\74\65\73\74" ;; "test"
740 "\03\ed\c0\80" ;; "\ed\c0\80"
741 "\03" ;; GlobalImport
742 "\7f" ;; i32
743 "\00" ;; immutable
744 )
745 "invalid UTF-8 encoding"
746)
747
748;; first byte after (0xed) 3-byte prefix not a continuation byte
749(assert_malformed
750 (module binary
751 "\00asm" "\01\00\00\00"
752 "\02\0d" ;; import section
753 "\01" ;; length 1
754 "\04\74\65\73\74" ;; "test"
755 "\03\ed\fd\80" ;; "\ed\fd\80"
756 "\03" ;; GlobalImport
757 "\7f" ;; i32
758 "\00" ;; immutable
759 )
760 "invalid UTF-8 encoding"
761)
762
763;; first byte after (normal) 3-byte prefix not a continuation byte
764(assert_malformed
765 (module binary
766 "\00asm" "\01\00\00\00"
767 "\02\0d" ;; import section
768 "\01" ;; length 1
769 "\04\74\65\73\74" ;; "test"
770 "\03\ee\00\80" ;; "\ee\00\80"
771 "\03" ;; GlobalImport
772 "\7f" ;; i32
773 "\00" ;; immutable
774 )
775 "invalid UTF-8 encoding"
776)
777
778;; first byte after (normal) 3-byte prefix not a continuation byte
779(assert_malformed
780 (module binary
781 "\00asm" "\01\00\00\00"
782 "\02\0d" ;; import section
783 "\01" ;; length 1
784 "\04\74\65\73\74" ;; "test"
785 "\03\ee\7f\80" ;; "\ee\7f\80"
786 "\03" ;; GlobalImport
787 "\7f" ;; i32
788 "\00" ;; immutable
789 )
790 "invalid UTF-8 encoding"
791)
792
793;; first byte after (normal) 3-byte prefix not a continuation byte
794(assert_malformed
795 (module binary
796 "\00asm" "\01\00\00\00"
797 "\02\0d" ;; import section
798 "\01" ;; length 1
799 "\04\74\65\73\74" ;; "test"
800 "\03\ee\c0\80" ;; "\ee\c0\80"
801 "\03" ;; GlobalImport
802 "\7f" ;; i32
803 "\00" ;; immutable
804 )
805 "invalid UTF-8 encoding"
806)
807
808;; first byte after (normal) 3-byte prefix not a continuation byte
809(assert_malformed
810 (module binary
811 "\00asm" "\01\00\00\00"
812 "\02\0d" ;; import section
813 "\01" ;; length 1
814 "\04\74\65\73\74" ;; "test"
815 "\03\ee\fd\80" ;; "\ee\fd\80"
816 "\03" ;; GlobalImport
817 "\7f" ;; i32
818 "\00" ;; immutable
819 )
820 "invalid UTF-8 encoding"
821)
822
823;; first byte after (last normal) 3-byte prefix not a continuation byte
824(assert_malformed
825 (module binary
826 "\00asm" "\01\00\00\00"
827 "\02\0d" ;; import section
828 "\01" ;; length 1
829 "\04\74\65\73\74" ;; "test"
830 "\03\ef\00\80" ;; "\ef\00\80"
831 "\03" ;; GlobalImport
832 "\7f" ;; i32
833 "\00" ;; immutable
834 )
835 "invalid UTF-8 encoding"
836)
837
838;; first byte after (last normal) 3-byte prefix not a continuation byte
839(assert_malformed
840 (module binary
841 "\00asm" "\01\00\00\00"
842 "\02\0d" ;; import section
843 "\01" ;; length 1
844 "\04\74\65\73\74" ;; "test"
845 "\03\ef\7f\80" ;; "\ef\7f\80"
846 "\03" ;; GlobalImport
847 "\7f" ;; i32
848 "\00" ;; immutable
849 )
850 "invalid UTF-8 encoding"
851)
852
853;; first byte after (last normal) 3-byte prefix not a continuation byte
854(assert_malformed
855 (module binary
856 "\00asm" "\01\00\00\00"
857 "\02\0d" ;; import section
858 "\01" ;; length 1
859 "\04\74\65\73\74" ;; "test"
860 "\03\ef\c0\80" ;; "\ef\c0\80"
861 "\03" ;; GlobalImport
862 "\7f" ;; i32
863 "\00" ;; immutable
864 )
865 "invalid UTF-8 encoding"
866)
867
868;; first byte after (last normal) 3-byte prefix not a continuation byte
869(assert_malformed
870 (module binary
871 "\00asm" "\01\00\00\00"
872 "\02\0d" ;; import section
873 "\01" ;; length 1
874 "\04\74\65\73\74" ;; "test"
875 "\03\ef\fd\80" ;; "\ef\fd\80"
876 "\03" ;; GlobalImport
877 "\7f" ;; i32
878 "\00" ;; immutable
879 )
880 "invalid UTF-8 encoding"
881)
882
883;;;; 3-byte sequence contents (third byte)
884
885;; second byte after (0xe0) 3-byte prefix not a continuation byte
886(assert_malformed
887 (module binary
888 "\00asm" "\01\00\00\00"
889 "\02\0d" ;; import section
890 "\01" ;; length 1
891 "\04\74\65\73\74" ;; "test"
892 "\03\e0\a0\00" ;; "\e0\a0\00"
893 "\03" ;; GlobalImport
894 "\7f" ;; i32
895 "\00" ;; immutable
896 )
897 "invalid UTF-8 encoding"
898)
899
900;; second byte after (0xe0) 3-byte prefix not a continuation byte
901(assert_malformed
902 (module binary
903 "\00asm" "\01\00\00\00"
904 "\02\0d" ;; import section
905 "\01" ;; length 1
906 "\04\74\65\73\74" ;; "test"
907 "\03\e0\a0\7f" ;; "\e0\a0\7f"
908 "\03" ;; GlobalImport
909 "\7f" ;; i32
910 "\00" ;; immutable
911 )
912 "invalid UTF-8 encoding"
913)
914
915;; second byte after (0xe0) 3-byte prefix not a continuation byte
916(assert_malformed
917 (module binary
918 "\00asm" "\01\00\00\00"
919 "\02\0d" ;; import section
920 "\01" ;; length 1
921 "\04\74\65\73\74" ;; "test"
922 "\03\e0\a0\c0" ;; "\e0\a0\c0"
923 "\03" ;; GlobalImport
924 "\7f" ;; i32
925 "\00" ;; immutable
926 )
927 "invalid UTF-8 encoding"
928)
929
930;; second byte after (0xe0) 3-byte prefix not a continuation byte
931(assert_malformed
932 (module binary
933 "\00asm" "\01\00\00\00"
934 "\02\0d" ;; import section
935 "\01" ;; length 1
936 "\04\74\65\73\74" ;; "test"
937 "\03\e0\a0\fd" ;; "\e0\a0\fd"
938 "\03" ;; GlobalImport
939 "\7f" ;; i32
940 "\00" ;; immutable
941 )
942 "invalid UTF-8 encoding"
943)
944
945;; second byte after (first normal) 3-byte prefix not a continuation byte
946(assert_malformed
947 (module binary
948 "\00asm" "\01\00\00\00"
949 "\02\0d" ;; import section
950 "\01" ;; length 1
951 "\04\74\65\73\74" ;; "test"
952 "\03\e1\80\00" ;; "\e1\80\00"
953 "\03" ;; GlobalImport
954 "\7f" ;; i32
955 "\00" ;; immutable
956 )
957 "invalid UTF-8 encoding"
958)
959
960;; second byte after (first normal) 3-byte prefix not a continuation byte
961(assert_malformed
962 (module binary
963 "\00asm" "\01\00\00\00"
964 "\02\0d" ;; import section
965 "\01" ;; length 1
966 "\04\74\65\73\74" ;; "test"
967 "\03\e1\80\7f" ;; "\e1\80\7f"
968 "\03" ;; GlobalImport
969 "\7f" ;; i32
970 "\00" ;; immutable
971 )
972 "invalid UTF-8 encoding"
973)
974
975;; second byte after (first normal) 3-byte prefix not a continuation byte
976(assert_malformed
977 (module binary
978 "\00asm" "\01\00\00\00"
979 "\02\0d" ;; import section
980 "\01" ;; length 1
981 "\04\74\65\73\74" ;; "test"
982 "\03\e1\80\c0" ;; "\e1\80\c0"
983 "\03" ;; GlobalImport
984 "\7f" ;; i32
985 "\00" ;; immutable
986 )
987 "invalid UTF-8 encoding"
988)
989
990;; second byte after (first normal) 3-byte prefix not a continuation byte
991(assert_malformed
992 (module binary
993 "\00asm" "\01\00\00\00"
994 "\02\0d" ;; import section
995 "\01" ;; length 1
996 "\04\74\65\73\74" ;; "test"
997 "\03\e1\80\fd" ;; "\e1\80\fd"
998 "\03" ;; GlobalImport
999 "\7f" ;; i32
1000 "\00" ;; immutable
1001 )
1002 "invalid UTF-8 encoding"
1003)
1004
1005;; second byte after (normal) 3-byte prefix not a continuation byte
1006(assert_malformed
1007 (module binary
1008 "\00asm" "\01\00\00\00"
1009 "\02\0d" ;; import section
1010 "\01" ;; length 1
1011 "\04\74\65\73\74" ;; "test"
1012 "\03\ec\80\00" ;; "\ec\80\00"
1013 "\03" ;; GlobalImport
1014 "\7f" ;; i32
1015 "\00" ;; immutable
1016 )
1017 "invalid UTF-8 encoding"
1018)
1019
1020;; second byte after (normal) 3-byte prefix not a continuation byte
1021(assert_malformed
1022 (module binary
1023 "\00asm" "\01\00\00\00"
1024 "\02\0d" ;; import section
1025 "\01" ;; length 1
1026 "\04\74\65\73\74" ;; "test"
1027 "\03\ec\80\7f" ;; "\ec\80\7f"
1028 "\03" ;; GlobalImport
1029 "\7f" ;; i32
1030 "\00" ;; immutable
1031 )
1032 "invalid UTF-8 encoding"
1033)
1034
1035;; second byte after (normal) 3-byte prefix not a continuation byte
1036(assert_malformed
1037 (module binary
1038 "\00asm" "\01\00\00\00"
1039 "\02\0d" ;; import section
1040 "\01" ;; length 1
1041 "\04\74\65\73\74" ;; "test"
1042 "\03\ec\80\c0" ;; "\ec\80\c0"
1043 "\03" ;; GlobalImport
1044 "\7f" ;; i32
1045 "\00" ;; immutable
1046 )
1047 "invalid UTF-8 encoding"
1048)
1049
1050;; second byte after (normal) 3-byte prefix not a continuation byte
1051(assert_malformed
1052 (module binary
1053 "\00asm" "\01\00\00\00"
1054 "\02\0d" ;; import section
1055 "\01" ;; length 1
1056 "\04\74\65\73\74" ;; "test"
1057 "\03\ec\80\fd" ;; "\ec\80\fd"
1058 "\03" ;; GlobalImport
1059 "\7f" ;; i32
1060 "\00" ;; immutable
1061 )
1062 "invalid UTF-8 encoding"
1063)
1064
1065;; second byte after (0xed) 3-byte prefix not a continuation byte
1066(assert_malformed
1067 (module binary
1068 "\00asm" "\01\00\00\00"
1069 "\02\0d" ;; import section
1070 "\01" ;; length 1
1071 "\04\74\65\73\74" ;; "test"
1072 "\03\ed\80\00" ;; "\ed\80\00"
1073 "\03" ;; GlobalImport
1074 "\7f" ;; i32
1075 "\00" ;; immutable
1076 )
1077 "invalid UTF-8 encoding"
1078)
1079
1080;; second byte after (0xed) 3-byte prefix not a continuation byte
1081(assert_malformed
1082 (module binary
1083 "\00asm" "\01\00\00\00"
1084 "\02\0d" ;; import section
1085 "\01" ;; length 1
1086 "\04\74\65\73\74" ;; "test"
1087 "\03\ed\80\7f" ;; "\ed\80\7f"
1088 "\03" ;; GlobalImport
1089 "\7f" ;; i32
1090 "\00" ;; immutable
1091 )
1092 "invalid UTF-8 encoding"
1093)
1094
1095;; second byte after (0xed) 3-byte prefix not a continuation byte
1096(assert_malformed
1097 (module binary
1098 "\00asm" "\01\00\00\00"
1099 "\02\0d" ;; import section
1100 "\01" ;; length 1
1101 "\04\74\65\73\74" ;; "test"
1102 "\03\ed\80\c0" ;; "\ed\80\c0"
1103 "\03" ;; GlobalImport
1104 "\7f" ;; i32
1105 "\00" ;; immutable
1106 )
1107 "invalid UTF-8 encoding"
1108)
1109
1110;; second byte after (0xed) 3-byte prefix not a continuation byte
1111(assert_malformed
1112 (module binary
1113 "\00asm" "\01\00\00\00"
1114 "\02\0d" ;; import section
1115 "\01" ;; length 1
1116 "\04\74\65\73\74" ;; "test"
1117 "\03\ed\80\fd" ;; "\ed\80\fd"
1118 "\03" ;; GlobalImport
1119 "\7f" ;; i32
1120 "\00" ;; immutable
1121 )
1122 "invalid UTF-8 encoding"
1123)
1124
1125;; second byte after (normal) 3-byte prefix not a continuation byte
1126(assert_malformed
1127 (module binary
1128 "\00asm" "\01\00\00\00"
1129 "\02\0d" ;; import section
1130 "\01" ;; length 1
1131 "\04\74\65\73\74" ;; "test"
1132 "\03\ee\80\00" ;; "\ee\80\00"
1133 "\03" ;; GlobalImport
1134 "\7f" ;; i32
1135 "\00" ;; immutable
1136 )
1137 "invalid UTF-8 encoding"
1138)
1139
1140;; second byte after (normal) 3-byte prefix not a continuation byte
1141(assert_malformed
1142 (module binary
1143 "\00asm" "\01\00\00\00"
1144 "\02\0d" ;; import section
1145 "\01" ;; length 1
1146 "\04\74\65\73\74" ;; "test"
1147 "\03\ee\80\7f" ;; "\ee\80\7f"
1148 "\03" ;; GlobalImport
1149 "\7f" ;; i32
1150 "\00" ;; immutable
1151 )
1152 "invalid UTF-8 encoding"
1153)
1154
1155;; second byte after (normal) 3-byte prefix not a continuation byte
1156(assert_malformed
1157 (module binary
1158 "\00asm" "\01\00\00\00"
1159 "\02\0d" ;; import section
1160 "\01" ;; length 1
1161 "\04\74\65\73\74" ;; "test"
1162 "\03\ee\80\c0" ;; "\ee\80\c0"
1163 "\03" ;; GlobalImport
1164 "\7f" ;; i32
1165 "\00" ;; immutable
1166 )
1167 "invalid UTF-8 encoding"
1168)
1169
1170;; second byte after (normal) 3-byte prefix not a continuation byte
1171(assert_malformed
1172 (module binary
1173 "\00asm" "\01\00\00\00"
1174 "\02\0d" ;; import section
1175 "\01" ;; length 1
1176 "\04\74\65\73\74" ;; "test"
1177 "\03\ee\80\fd" ;; "\ee\80\fd"
1178 "\03" ;; GlobalImport
1179 "\7f" ;; i32
1180 "\00" ;; immutable
1181 )
1182 "invalid UTF-8 encoding"
1183)
1184
1185;; second byte after (last normal) 3-byte prefix not a continuation byte
1186(assert_malformed
1187 (module binary
1188 "\00asm" "\01\00\00\00"
1189 "\02\0d" ;; import section
1190 "\01" ;; length 1
1191 "\04\74\65\73\74" ;; "test"
1192 "\03\ef\80\00" ;; "\ef\80\00"
1193 "\03" ;; GlobalImport
1194 "\7f" ;; i32
1195 "\00" ;; immutable
1196 )
1197 "invalid UTF-8 encoding"
1198)
1199
1200;; second byte after (last normal) 3-byte prefix not a continuation byte
1201(assert_malformed
1202 (module binary
1203 "\00asm" "\01\00\00\00"
1204 "\02\0d" ;; import section
1205 "\01" ;; length 1
1206 "\04\74\65\73\74" ;; "test"
1207 "\03\ef\80\7f" ;; "\ef\80\7f"
1208 "\03" ;; GlobalImport
1209 "\7f" ;; i32
1210 "\00" ;; immutable
1211 )
1212 "invalid UTF-8 encoding"
1213)
1214
1215;; second byte after (last normal) 3-byte prefix not a continuation byte
1216(assert_malformed
1217 (module binary
1218 "\00asm" "\01\00\00\00"
1219 "\02\0d" ;; import section
1220 "\01" ;; length 1
1221 "\04\74\65\73\74" ;; "test"
1222 "\03\ef\80\c0" ;; "\ef\80\c0"
1223 "\03" ;; GlobalImport
1224 "\7f" ;; i32
1225 "\00" ;; immutable
1226 )
1227 "invalid UTF-8 encoding"
1228)
1229
1230;; second byte after (last normal) 3-byte prefix not a continuation byte
1231(assert_malformed
1232 (module binary
1233 "\00asm" "\01\00\00\00"
1234 "\02\0d" ;; import section
1235 "\01" ;; length 1
1236 "\04\74\65\73\74" ;; "test"
1237 "\03\ef\80\fd" ;; "\ef\80\fd"
1238 "\03" ;; GlobalImport
1239 "\7f" ;; i32
1240 "\00" ;; immutable
1241 )
1242 "invalid UTF-8 encoding"
1243)
1244
1245;;;; 4-byte sequences
1246
1247;; 4-byte sequence contains 5 bytes
1248(assert_malformed
1249 (module binary
1250 "\00asm" "\01\00\00\00"
1251 "\02\0f" ;; import section
1252 "\01" ;; length 1
1253 "\04\74\65\73\74" ;; "test"
1254 "\05\f1\80\80\80\80" ;; "\f1\80\80\80\80"
1255 "\03" ;; GlobalImport
1256 "\7f" ;; i32
1257 "\00" ;; immutable
1258 )
1259 "invalid UTF-8 encoding"
1260)
1261
1262;; 4-byte sequence contains 3 bytes at end of string
1263(assert_malformed
1264 (module binary
1265 "\00asm" "\01\00\00\00"
1266 "\02\0d" ;; import section
1267 "\01" ;; length 1
1268 "\04\74\65\73\74" ;; "test"
1269 "\03\f1\80\80" ;; "\f1\80\80"
1270 "\03" ;; GlobalImport
1271 "\7f" ;; i32
1272 "\00" ;; immutable
1273 )
1274 "invalid UTF-8 encoding"
1275)
1276
1277;; 4-byte sequence contains 3 bytes
1278(assert_malformed
1279 (module binary
1280 "\00asm" "\01\00\00\00"
1281 "\02\0e" ;; import section
1282 "\01" ;; length 1
1283 "\04\74\65\73\74" ;; "test"
1284 "\04\f1\80\80\23" ;; "\f1\80\80#"
1285 "\03" ;; GlobalImport
1286 "\7f" ;; i32
1287 "\00" ;; immutable
1288 )
1289 "invalid UTF-8 encoding"
1290)
1291
1292;; 4-byte sequence contains 2 bytes at end of string
1293(assert_malformed
1294 (module binary
1295 "\00asm" "\01\00\00\00"
1296 "\02\0c" ;; import section
1297 "\01" ;; length 1
1298 "\04\74\65\73\74" ;; "test"
1299 "\02\f1\80" ;; "\f1\80"
1300 "\03" ;; GlobalImport
1301 "\7f" ;; i32
1302 "\00" ;; immutable
1303 )
1304 "invalid UTF-8 encoding"
1305)
1306
1307;; 4-byte sequence contains 2 bytes
1308(assert_malformed
1309 (module binary
1310 "\00asm" "\01\00\00\00"
1311 "\02\0d" ;; import section
1312 "\01" ;; length 1
1313 "\04\74\65\73\74" ;; "test"
1314 "\03\f1\80\23" ;; "\f1\80#"
1315 "\03" ;; GlobalImport
1316 "\7f" ;; i32
1317 "\00" ;; immutable
1318 )
1319 "invalid UTF-8 encoding"
1320)
1321
1322;; 4-byte sequence contains 1 byte at end of string
1323(assert_malformed
1324 (module binary
1325 "\00asm" "\01\00\00\00"
1326 "\02\0b" ;; import section
1327 "\01" ;; length 1
1328 "\04\74\65\73\74" ;; "test"
1329 "\01\f1" ;; "\f1"
1330 "\03" ;; GlobalImport
1331 "\7f" ;; i32
1332 "\00" ;; immutable
1333 )
1334 "invalid UTF-8 encoding"
1335)
1336
1337;; 4-byte sequence contains 1 byte
1338(assert_malformed
1339 (module binary
1340 "\00asm" "\01\00\00\00"
1341 "\02\0c" ;; import section
1342 "\01" ;; length 1
1343 "\04\74\65\73\74" ;; "test"
1344 "\02\f1\23" ;; "\f1#"
1345 "\03" ;; GlobalImport
1346 "\7f" ;; i32
1347 "\00" ;; immutable
1348 )
1349 "invalid UTF-8 encoding"
1350)
1351
1352;;;; 4-byte sequence contents
1353
1354;; first byte after (0xf0) 4-byte prefix not a continuation byte
1355(assert_malformed
1356 (module binary
1357 "\00asm" "\01\00\00\00"
1358 "\02\0e" ;; import section
1359 "\01" ;; length 1
1360 "\04\74\65\73\74" ;; "test"
1361 "\04\f0\00\90\90" ;; "\f0\00\90\90"
1362 "\03" ;; GlobalImport
1363 "\7f" ;; i32
1364 "\00" ;; immutable
1365 )
1366 "invalid UTF-8 encoding"
1367)
1368
1369;; first byte after (0xf0) 4-byte prefix not a continuation byte
1370(assert_malformed
1371 (module binary
1372 "\00asm" "\01\00\00\00"
1373 "\02\0e" ;; import section
1374 "\01" ;; length 1
1375 "\04\74\65\73\74" ;; "test"
1376 "\04\f0\7f\90\90" ;; "\f0\7f\90\90"
1377 "\03" ;; GlobalImport
1378 "\7f" ;; i32
1379 "\00" ;; immutable
1380 )
1381 "invalid UTF-8 encoding"
1382)
1383
1384;; overlong encoding after 0xf0 prefix
1385(assert_malformed
1386 (module binary
1387 "\00asm" "\01\00\00\00"
1388 "\02\0e" ;; import section
1389 "\01" ;; length 1
1390 "\04\74\65\73\74" ;; "test"
1391 "\04\f0\80\80\80" ;; "\f0\80\80\80"
1392 "\03" ;; GlobalImport
1393 "\7f" ;; i32
1394 "\00" ;; immutable
1395 )
1396 "invalid UTF-8 encoding"
1397)
1398
1399;; overlong encoding after 0xf0 prefix
1400(assert_malformed
1401 (module binary
1402 "\00asm" "\01\00\00\00"
1403 "\02\0e" ;; import section
1404 "\01" ;; length 1
1405 "\04\74\65\73\74" ;; "test"
1406 "\04\f0\80\90\90" ;; "\f0\80\90\90"
1407 "\03" ;; GlobalImport
1408 "\7f" ;; i32
1409 "\00" ;; immutable
1410 )
1411 "invalid UTF-8 encoding"
1412)
1413
1414;; overlong encoding after 0xf0 prefix
1415(assert_malformed
1416 (module binary
1417 "\00asm" "\01\00\00\00"
1418 "\02\0e" ;; import section
1419 "\01" ;; length 1
1420 "\04\74\65\73\74" ;; "test"
1421 "\04\f0\8f\90\90" ;; "\f0\8f\90\90"
1422 "\03" ;; GlobalImport
1423 "\7f" ;; i32
1424 "\00" ;; immutable
1425 )
1426 "invalid UTF-8 encoding"
1427)
1428
1429;; overlong encoding after 0xf0 prefix
1430(assert_malformed
1431 (module binary
1432 "\00asm" "\01\00\00\00"
1433 "\02\0e" ;; import section
1434 "\01" ;; length 1
1435 "\04\74\65\73\74" ;; "test"
1436 "\04\f0\8f\bf\bf" ;; "\f0\8f\bf\bf"
1437 "\03" ;; GlobalImport
1438 "\7f" ;; i32
1439 "\00" ;; immutable
1440 )
1441 "invalid UTF-8 encoding"
1442)
1443
1444;; first byte after (0xf0) 4-byte prefix not a continuation byte
1445(assert_malformed
1446 (module binary
1447 "\00asm" "\01\00\00\00"
1448 "\02\0e" ;; import section
1449 "\01" ;; length 1
1450 "\04\74\65\73\74" ;; "test"
1451 "\04\f0\c0\90\90" ;; "\f0\c0\90\90"
1452 "\03" ;; GlobalImport
1453 "\7f" ;; i32
1454 "\00" ;; immutable
1455 )
1456 "invalid UTF-8 encoding"
1457)
1458
1459;; first byte after (0xf0) 4-byte prefix not a continuation byte
1460(assert_malformed
1461 (module binary
1462 "\00asm" "\01\00\00\00"
1463 "\02\0e" ;; import section
1464 "\01" ;; length 1
1465 "\04\74\65\73\74" ;; "test"
1466 "\04\f0\fd\90\90" ;; "\f0\fd\90\90"
1467 "\03" ;; GlobalImport
1468 "\7f" ;; i32
1469 "\00" ;; immutable
1470 )
1471 "invalid UTF-8 encoding"
1472)
1473
1474;; first byte after (first normal) 4-byte prefix not a continuation byte
1475(assert_malformed
1476 (module binary
1477 "\00asm" "\01\00\00\00"
1478 "\02\0e" ;; import section
1479 "\01" ;; length 1
1480 "\04\74\65\73\74" ;; "test"
1481 "\04\f1\00\80\80" ;; "\f1\00\80\80"
1482 "\03" ;; GlobalImport
1483 "\7f" ;; i32
1484 "\00" ;; immutable
1485 )
1486 "invalid UTF-8 encoding"
1487)
1488
1489;; first byte after (first normal) 4-byte prefix not a continuation byte
1490(assert_malformed
1491 (module binary
1492 "\00asm" "\01\00\00\00"
1493 "\02\0e" ;; import section
1494 "\01" ;; length 1
1495 "\04\74\65\73\74" ;; "test"
1496 "\04\f1\7f\80\80" ;; "\f1\7f\80\80"
1497 "\03" ;; GlobalImport
1498 "\7f" ;; i32
1499 "\00" ;; immutable
1500 )
1501 "invalid UTF-8 encoding"
1502)
1503
1504;; first byte after (first normal) 4-byte prefix not a continuation byte
1505(assert_malformed
1506 (module binary
1507 "\00asm" "\01\00\00\00"
1508 "\02\0e" ;; import section
1509 "\01" ;; length 1
1510 "\04\74\65\73\74" ;; "test"
1511 "\04\f1\c0\80\80" ;; "\f1\c0\80\80"
1512 "\03" ;; GlobalImport
1513 "\7f" ;; i32
1514 "\00" ;; immutable
1515 )
1516 "invalid UTF-8 encoding"
1517)
1518
1519;; first byte after (first normal) 4-byte prefix not a continuation byte
1520(assert_malformed
1521 (module binary
1522 "\00asm" "\01\00\00\00"
1523 "\02\0e" ;; import section
1524 "\01" ;; length 1
1525 "\04\74\65\73\74" ;; "test"
1526 "\04\f1\fd\80\80" ;; "\f1\fd\80\80"
1527 "\03" ;; GlobalImport
1528 "\7f" ;; i32
1529 "\00" ;; immutable
1530 )
1531 "invalid UTF-8 encoding"
1532)
1533
1534;; first byte after (last normal) 4-byte prefix not a continuation byte
1535(assert_malformed
1536 (module binary
1537 "\00asm" "\01\00\00\00"
1538 "\02\0e" ;; import section
1539 "\01" ;; length 1
1540 "\04\74\65\73\74" ;; "test"
1541 "\04\f3\00\80\80" ;; "\f3\00\80\80"
1542 "\03" ;; GlobalImport
1543 "\7f" ;; i32
1544 "\00" ;; immutable
1545 )
1546 "invalid UTF-8 encoding"
1547)
1548
1549;; first byte after (last normal) 4-byte prefix not a continuation byte
1550(assert_malformed
1551 (module binary
1552 "\00asm" "\01\00\00\00"
1553 "\02\0e" ;; import section
1554 "\01" ;; length 1
1555 "\04\74\65\73\74" ;; "test"
1556 "\04\f3\7f\80\80" ;; "\f3\7f\80\80"
1557 "\03" ;; GlobalImport
1558 "\7f" ;; i32
1559 "\00" ;; immutable
1560 )
1561 "invalid UTF-8 encoding"
1562)
1563
1564;; first byte after (last normal) 4-byte prefix not a continuation byte
1565(assert_malformed
1566 (module binary
1567 "\00asm" "\01\00\00\00"
1568 "\02\0e" ;; import section
1569 "\01" ;; length 1
1570 "\04\74\65\73\74" ;; "test"
1571 "\04\f3\c0\80\80" ;; "\f3\c0\80\80"
1572 "\03" ;; GlobalImport
1573 "\7f" ;; i32
1574 "\00" ;; immutable
1575 )
1576 "invalid UTF-8 encoding"
1577)
1578
1579;; first byte after (last normal) 4-byte prefix not a continuation byte
1580(assert_malformed
1581 (module binary
1582 "\00asm" "\01\00\00\00"
1583 "\02\0e" ;; import section
1584 "\01" ;; length 1
1585 "\04\74\65\73\74" ;; "test"
1586 "\04\f3\fd\80\80" ;; "\f3\fd\80\80"
1587 "\03" ;; GlobalImport
1588 "\7f" ;; i32
1589 "\00" ;; immutable
1590 )
1591 "invalid UTF-8 encoding"
1592)
1593
1594;; first byte after (0xf4) 4-byte prefix not a continuation byte
1595(assert_malformed
1596 (module binary
1597 "\00asm" "\01\00\00\00"
1598 "\02\0e" ;; import section
1599 "\01" ;; length 1
1600 "\04\74\65\73\74" ;; "test"
1601 "\04\f4\00\80\80" ;; "\f4\00\80\80"
1602 "\03" ;; GlobalImport
1603 "\7f" ;; i32
1604 "\00" ;; immutable
1605 )
1606 "invalid UTF-8 encoding"
1607)
1608
1609;; first byte after (0xf4) 4-byte prefix not a continuation byte
1610(assert_malformed
1611 (module binary
1612 "\00asm" "\01\00\00\00"
1613 "\02\0e" ;; import section
1614 "\01" ;; length 1
1615 "\04\74\65\73\74" ;; "test"
1616 "\04\f4\7f\80\80" ;; "\f4\7f\80\80"
1617 "\03" ;; GlobalImport
1618 "\7f" ;; i32
1619 "\00" ;; immutable
1620 )
1621 "invalid UTF-8 encoding"
1622)
1623
1624;; (first) invalid code point
1625(assert_malformed
1626 (module binary
1627 "\00asm" "\01\00\00\00"
1628 "\02\0e" ;; import section
1629 "\01" ;; length 1
1630 "\04\74\65\73\74" ;; "test"
1631 "\04\f4\90\80\80" ;; "\f4\90\80\80"
1632 "\03" ;; GlobalImport
1633 "\7f" ;; i32
1634 "\00" ;; immutable
1635 )
1636 "invalid UTF-8 encoding"
1637)
1638
1639;; invalid code point
1640(assert_malformed
1641 (module binary
1642 "\00asm" "\01\00\00\00"
1643 "\02\0e" ;; import section
1644 "\01" ;; length 1
1645 "\04\74\65\73\74" ;; "test"
1646 "\04\f4\bf\80\80" ;; "\f4\bf\80\80"
1647 "\03" ;; GlobalImport
1648 "\7f" ;; i32
1649 "\00" ;; immutable
1650 )
1651 "invalid UTF-8 encoding"
1652)
1653
1654;; first byte after (0xf4) 4-byte prefix not a continuation byte
1655(assert_malformed
1656 (module binary
1657 "\00asm" "\01\00\00\00"
1658 "\02\0e" ;; import section
1659 "\01" ;; length 1
1660 "\04\74\65\73\74" ;; "test"
1661 "\04\f4\c0\80\80" ;; "\f4\c0\80\80"
1662 "\03" ;; GlobalImport
1663 "\7f" ;; i32
1664 "\00" ;; immutable
1665 )
1666 "invalid UTF-8 encoding"
1667)
1668
1669;; first byte after (0xf4) 4-byte prefix not a continuation byte
1670(assert_malformed
1671 (module binary
1672 "\00asm" "\01\00\00\00"
1673 "\02\0e" ;; import section
1674 "\01" ;; length 1
1675 "\04\74\65\73\74" ;; "test"
1676 "\04\f4\fd\80\80" ;; "\f4\fd\80\80"
1677 "\03" ;; GlobalImport
1678 "\7f" ;; i32
1679 "\00" ;; immutable
1680 )
1681 "invalid UTF-8 encoding"
1682)
1683
1684;; (first) invalid 4-byte prefix
1685(assert_malformed
1686 (module binary
1687 "\00asm" "\01\00\00\00"
1688 "\02\0e" ;; import section
1689 "\01" ;; length 1
1690 "\04\74\65\73\74" ;; "test"
1691 "\04\f5\80\80\80" ;; "\f5\80\80\80"
1692 "\03" ;; GlobalImport
1693 "\7f" ;; i32
1694 "\00" ;; immutable
1695 )
1696 "invalid UTF-8 encoding"
1697)
1698
1699;; (last) invalid 4-byte prefix
1700(assert_malformed
1701 (module binary
1702 "\00asm" "\01\00\00\00"
1703 "\02\0e" ;; import section
1704 "\01" ;; length 1
1705 "\04\74\65\73\74" ;; "test"
1706 "\04\f7\80\80\80" ;; "\f7\80\80\80"
1707 "\03" ;; GlobalImport
1708 "\7f" ;; i32
1709 "\00" ;; immutable
1710 )
1711 "invalid UTF-8 encoding"
1712)
1713
1714;; (last) invalid 4-byte prefix
1715(assert_malformed
1716 (module binary
1717 "\00asm" "\01\00\00\00"
1718 "\02\0e" ;; import section
1719 "\01" ;; length 1
1720 "\04\74\65\73\74" ;; "test"
1721 "\04\f7\bf\bf\bf" ;; "\f7\bf\bf\bf"
1722 "\03" ;; GlobalImport
1723 "\7f" ;; i32
1724 "\00" ;; immutable
1725 )
1726 "invalid UTF-8 encoding"
1727)
1728
1729;;;; 4-byte sequence contents (third byte)
1730
1731;; second byte after (0xf0) 4-byte prefix not a continuation byte
1732(assert_malformed
1733 (module binary
1734 "\00asm" "\01\00\00\00"
1735 "\02\0e" ;; import section
1736 "\01" ;; length 1
1737 "\04\74\65\73\74" ;; "test"
1738 "\04\f0\90\00\90" ;; "\f0\90\00\90"
1739 "\03" ;; GlobalImport
1740 "\7f" ;; i32
1741 "\00" ;; immutable
1742 )
1743 "invalid UTF-8 encoding"
1744)
1745
1746;; second byte after (0xf0) 4-byte prefix not a continuation byte
1747(assert_malformed
1748 (module binary
1749 "\00asm" "\01\00\00\00"
1750 "\02\0e" ;; import section
1751 "\01" ;; length 1
1752 "\04\74\65\73\74" ;; "test"
1753 "\04\f0\90\7f\90" ;; "\f0\90\7f\90"
1754 "\03" ;; GlobalImport
1755 "\7f" ;; i32
1756 "\00" ;; immutable
1757 )
1758 "invalid UTF-8 encoding"
1759)
1760
1761;; second byte after (0xf0) 4-byte prefix not a continuation byte
1762(assert_malformed
1763 (module binary
1764 "\00asm" "\01\00\00\00"
1765 "\02\0e" ;; import section
1766 "\01" ;; length 1
1767 "\04\74\65\73\74" ;; "test"
1768 "\04\f0\90\c0\90" ;; "\f0\90\c0\90"
1769 "\03" ;; GlobalImport
1770 "\7f" ;; i32
1771 "\00" ;; immutable
1772 )
1773 "invalid UTF-8 encoding"
1774)
1775
1776;; second byte after (0xf0) 4-byte prefix not a continuation byte
1777(assert_malformed
1778 (module binary
1779 "\00asm" "\01\00\00\00"
1780 "\02\0e" ;; import section
1781 "\01" ;; length 1
1782 "\04\74\65\73\74" ;; "test"
1783 "\04\f0\90\fd\90" ;; "\f0\90\fd\90"
1784 "\03" ;; GlobalImport
1785 "\7f" ;; i32
1786 "\00" ;; immutable
1787 )
1788 "invalid UTF-8 encoding"
1789)
1790
1791;; second byte after (first normal) 4-byte prefix not a continuation byte
1792(assert_malformed
1793 (module binary
1794 "\00asm" "\01\00\00\00"
1795 "\02\0e" ;; import section
1796 "\01" ;; length 1
1797 "\04\74\65\73\74" ;; "test"
1798 "\04\f1\80\00\80" ;; "\f1\80\00\80"
1799 "\03" ;; GlobalImport
1800 "\7f" ;; i32
1801 "\00" ;; immutable
1802 )
1803 "invalid UTF-8 encoding"
1804)
1805
1806;; second byte after (first normal) 4-byte prefix not a continuation byte
1807(assert_malformed
1808 (module binary
1809 "\00asm" "\01\00\00\00"
1810 "\02\0e" ;; import section
1811 "\01" ;; length 1
1812 "\04\74\65\73\74" ;; "test"
1813 "\04\f1\80\7f\80" ;; "\f1\80\7f\80"
1814 "\03" ;; GlobalImport
1815 "\7f" ;; i32
1816 "\00" ;; immutable
1817 )
1818 "invalid UTF-8 encoding"
1819)
1820
1821;; second byte after (first normal) 4-byte prefix not a continuation byte
1822(assert_malformed
1823 (module binary
1824 "\00asm" "\01\00\00\00"
1825 "\02\0e" ;; import section
1826 "\01" ;; length 1
1827 "\04\74\65\73\74" ;; "test"
1828 "\04\f1\80\c0\80" ;; "\f1\80\c0\80"
1829 "\03" ;; GlobalImport
1830 "\7f" ;; i32
1831 "\00" ;; immutable
1832 )
1833 "invalid UTF-8 encoding"
1834)
1835
1836;; second byte after (first normal) 4-byte prefix not a continuation byte
1837(assert_malformed
1838 (module binary
1839 "\00asm" "\01\00\00\00"
1840 "\02\0e" ;; import section
1841 "\01" ;; length 1
1842 "\04\74\65\73\74" ;; "test"
1843 "\04\f1\80\fd\80" ;; "\f1\80\fd\80"
1844 "\03" ;; GlobalImport
1845 "\7f" ;; i32
1846 "\00" ;; immutable
1847 )
1848 "invalid UTF-8 encoding"
1849)
1850
1851;; second byte after (last normal) 4-byte prefix not a continuation byte
1852(assert_malformed
1853 (module binary
1854 "\00asm" "\01\00\00\00"
1855 "\02\0e" ;; import section
1856 "\01" ;; length 1
1857 "\04\74\65\73\74" ;; "test"
1858 "\04\f3\80\00\80" ;; "\f3\80\00\80"
1859 "\03" ;; GlobalImport
1860 "\7f" ;; i32
1861 "\00" ;; immutable
1862 )
1863 "invalid UTF-8 encoding"
1864)
1865
1866;; second byte after (last normal) 4-byte prefix not a continuation byte
1867(assert_malformed
1868 (module binary
1869 "\00asm" "\01\00\00\00"
1870 "\02\0e" ;; import section
1871 "\01" ;; length 1
1872 "\04\74\65\73\74" ;; "test"
1873 "\04\f3\80\7f\80" ;; "\f3\80\7f\80"
1874 "\03" ;; GlobalImport
1875 "\7f" ;; i32
1876 "\00" ;; immutable
1877 )
1878 "invalid UTF-8 encoding"
1879)
1880
1881;; second byte after (last normal) 4-byte prefix not a continuation byte
1882(assert_malformed
1883 (module binary
1884 "\00asm" "\01\00\00\00"
1885 "\02\0e" ;; import section
1886 "\01" ;; length 1
1887 "\04\74\65\73\74" ;; "test"
1888 "\04\f3\80\c0\80" ;; "\f3\80\c0\80"
1889 "\03" ;; GlobalImport
1890 "\7f" ;; i32
1891 "\00" ;; immutable
1892 )
1893 "invalid UTF-8 encoding"
1894)
1895
1896;; second byte after (last normal) 4-byte prefix not a continuation byte
1897(assert_malformed
1898 (module binary
1899 "\00asm" "\01\00\00\00"
1900 "\02\0e" ;; import section
1901 "\01" ;; length 1
1902 "\04\74\65\73\74" ;; "test"
1903 "\04\f3\80\fd\80" ;; "\f3\80\fd\80"
1904 "\03" ;; GlobalImport
1905 "\7f" ;; i32
1906 "\00" ;; immutable
1907 )
1908 "invalid UTF-8 encoding"
1909)
1910
1911;; second byte after (0xf4) 4-byte prefix not a continuation byte
1912(assert_malformed
1913 (module binary
1914 "\00asm" "\01\00\00\00"
1915 "\02\0e" ;; import section
1916 "\01" ;; length 1
1917 "\04\74\65\73\74" ;; "test"
1918 "\04\f4\80\00\80" ;; "\f4\80\00\80"
1919 "\03" ;; GlobalImport
1920 "\7f" ;; i32
1921 "\00" ;; immutable
1922 )
1923 "invalid UTF-8 encoding"
1924)
1925
1926;; second byte after (0xf4) 4-byte prefix not a continuation byte
1927(assert_malformed
1928 (module binary
1929 "\00asm" "\01\00\00\00"
1930 "\02\0e" ;; import section
1931 "\01" ;; length 1
1932 "\04\74\65\73\74" ;; "test"
1933 "\04\f4\80\7f\80" ;; "\f4\80\7f\80"
1934 "\03" ;; GlobalImport
1935 "\7f" ;; i32
1936 "\00" ;; immutable
1937 )
1938 "invalid UTF-8 encoding"
1939)
1940
1941;; second byte after (0xf4) 4-byte prefix not a continuation byte
1942(assert_malformed
1943 (module binary
1944 "\00asm" "\01\00\00\00"
1945 "\02\0e" ;; import section
1946 "\01" ;; length 1
1947 "\04\74\65\73\74" ;; "test"
1948 "\04\f4\80\c0\80" ;; "\f4\80\c0\80"
1949 "\03" ;; GlobalImport
1950 "\7f" ;; i32
1951 "\00" ;; immutable
1952 )
1953 "invalid UTF-8 encoding"
1954)
1955
1956;; second byte after (0xf4) 4-byte prefix not a continuation byte
1957(assert_malformed
1958 (module binary
1959 "\00asm" "\01\00\00\00"
1960 "\02\0e" ;; import section
1961 "\01" ;; length 1
1962 "\04\74\65\73\74" ;; "test"
1963 "\04\f4\80\fd\80" ;; "\f4\80\fd\80"
1964 "\03" ;; GlobalImport
1965 "\7f" ;; i32
1966 "\00" ;; immutable
1967 )
1968 "invalid UTF-8 encoding"
1969)
1970
1971;;;; 4-byte sequence contents (fourth byte)
1972
1973;; third byte after (0xf0) 4-byte prefix not a continuation byte
1974(assert_malformed
1975 (module binary
1976 "\00asm" "\01\00\00\00"
1977 "\02\0e" ;; import section
1978 "\01" ;; length 1
1979 "\04\74\65\73\74" ;; "test"
1980 "\04\f0\90\90\00" ;; "\f0\90\90\00"
1981 "\03" ;; GlobalImport
1982 "\7f" ;; i32
1983 "\00" ;; immutable
1984 )
1985 "invalid UTF-8 encoding"
1986)
1987
1988;; third byte after (0xf0) 4-byte prefix not a continuation byte
1989(assert_malformed
1990 (module binary
1991 "\00asm" "\01\00\00\00"
1992 "\02\0e" ;; import section
1993 "\01" ;; length 1
1994 "\04\74\65\73\74" ;; "test"
1995 "\04\f0\90\90\7f" ;; "\f0\90\90\7f"
1996 "\03" ;; GlobalImport
1997 "\7f" ;; i32
1998 "\00" ;; immutable
1999 )
2000 "invalid UTF-8 encoding"
2001)
2002
2003;; third byte after (0xf0) 4-byte prefix not a continuation byte
2004(assert_malformed
2005 (module binary
2006 "\00asm" "\01\00\00\00"
2007 "\02\0e" ;; import section
2008 "\01" ;; length 1
2009 "\04\74\65\73\74" ;; "test"
2010 "\04\f0\90\90\c0" ;; "\f0\90\90\c0"
2011 "\03" ;; GlobalImport
2012 "\7f" ;; i32
2013 "\00" ;; immutable
2014 )
2015 "invalid UTF-8 encoding"
2016)
2017
2018;; third byte after (0xf0) 4-byte prefix not a continuation byte
2019(assert_malformed
2020 (module binary
2021 "\00asm" "\01\00\00\00"
2022 "\02\0e" ;; import section
2023 "\01" ;; length 1
2024 "\04\74\65\73\74" ;; "test"
2025 "\04\f0\90\90\fd" ;; "\f0\90\90\fd"
2026 "\03" ;; GlobalImport
2027 "\7f" ;; i32
2028 "\00" ;; immutable
2029 )
2030 "invalid UTF-8 encoding"
2031)
2032
2033;; third byte after (first normal) 4-byte prefix not a continuation byte
2034(assert_malformed
2035 (module binary
2036 "\00asm" "\01\00\00\00"
2037 "\02\0e" ;; import section
2038 "\01" ;; length 1
2039 "\04\74\65\73\74" ;; "test"
2040 "\04\f1\80\80\00" ;; "\f1\80\80\00"
2041 "\03" ;; GlobalImport
2042 "\7f" ;; i32
2043 "\00" ;; immutable
2044 )
2045 "invalid UTF-8 encoding"
2046)
2047
2048;; third byte after (first normal) 4-byte prefix not a continuation byte
2049(assert_malformed
2050 (module binary
2051 "\00asm" "\01\00\00\00"
2052 "\02\0e" ;; import section
2053 "\01" ;; length 1
2054 "\04\74\65\73\74" ;; "test"
2055 "\04\f1\80\80\7f" ;; "\f1\80\80\7f"
2056 "\03" ;; GlobalImport
2057 "\7f" ;; i32
2058 "\00" ;; immutable
2059 )
2060 "invalid UTF-8 encoding"
2061)
2062
2063;; third byte after (first normal) 4-byte prefix not a continuation byte
2064(assert_malformed
2065 (module binary
2066 "\00asm" "\01\00\00\00"
2067 "\02\0e" ;; import section
2068 "\01" ;; length 1
2069 "\04\74\65\73\74" ;; "test"
2070 "\04\f1\80\80\c0" ;; "\f1\80\80\c0"
2071 "\03" ;; GlobalImport
2072 "\7f" ;; i32
2073 "\00" ;; immutable
2074 )
2075 "invalid UTF-8 encoding"
2076)
2077
2078;; third byte after (first normal) 4-byte prefix not a continuation byte
2079(assert_malformed
2080 (module binary
2081 "\00asm" "\01\00\00\00"
2082 "\02\0e" ;; import section
2083 "\01" ;; length 1
2084 "\04\74\65\73\74" ;; "test"
2085 "\04\f1\80\80\fd" ;; "\f1\80\80\fd"
2086 "\03" ;; GlobalImport
2087 "\7f" ;; i32
2088 "\00" ;; immutable
2089 )
2090 "invalid UTF-8 encoding"
2091)
2092
2093;; third byte after (last normal) 4-byte prefix not a continuation byte
2094(assert_malformed
2095 (module binary
2096 "\00asm" "\01\00\00\00"
2097 "\02\0e" ;; import section
2098 "\01" ;; length 1
2099 "\04\74\65\73\74" ;; "test"
2100 "\04\f3\80\80\00" ;; "\f3\80\80\00"
2101 "\03" ;; GlobalImport
2102 "\7f" ;; i32
2103 "\00" ;; immutable
2104 )
2105 "invalid UTF-8 encoding"
2106)
2107
2108;; third byte after (last normal) 4-byte prefix not a continuation byte
2109(assert_malformed
2110 (module binary
2111 "\00asm" "\01\00\00\00"
2112 "\02\0e" ;; import section
2113 "\01" ;; length 1
2114 "\04\74\65\73\74" ;; "test"
2115 "\04\f3\80\80\7f" ;; "\f3\80\80\7f"
2116 "\03" ;; GlobalImport
2117 "\7f" ;; i32
2118 "\00" ;; immutable
2119 )
2120 "invalid UTF-8 encoding"
2121)
2122
2123;; third byte after (last normal) 4-byte prefix not a continuation byte
2124(assert_malformed
2125 (module binary
2126 "\00asm" "\01\00\00\00"
2127 "\02\0e" ;; import section
2128 "\01" ;; length 1
2129 "\04\74\65\73\74" ;; "test"
2130 "\04\f3\80\80\c0" ;; "\f3\80\80\c0"
2131 "\03" ;; GlobalImport
2132 "\7f" ;; i32
2133 "\00" ;; immutable
2134 )
2135 "invalid UTF-8 encoding"
2136)
2137
2138;; third byte after (last normal) 4-byte prefix not a continuation byte
2139(assert_malformed
2140 (module binary
2141 "\00asm" "\01\00\00\00"
2142 "\02\0e" ;; import section
2143 "\01" ;; length 1
2144 "\04\74\65\73\74" ;; "test"
2145 "\04\f3\80\80\fd" ;; "\f3\80\80\fd"
2146 "\03" ;; GlobalImport
2147 "\7f" ;; i32
2148 "\00" ;; immutable
2149 )
2150 "invalid UTF-8 encoding"
2151)
2152
2153;; third byte after (0xf4) 4-byte prefix not a continuation byte
2154(assert_malformed
2155 (module binary
2156 "\00asm" "\01\00\00\00"
2157 "\02\0e" ;; import section
2158 "\01" ;; length 1
2159 "\04\74\65\73\74" ;; "test"
2160 "\04\f4\80\80\00" ;; "\f4\80\80\00"
2161 "\03" ;; GlobalImport
2162 "\7f" ;; i32
2163 "\00" ;; immutable
2164 )
2165 "invalid UTF-8 encoding"
2166)
2167
2168;; third byte after (0xf4) 4-byte prefix not a continuation byte
2169(assert_malformed
2170 (module binary
2171 "\00asm" "\01\00\00\00"
2172 "\02\0e" ;; import section
2173 "\01" ;; length 1
2174 "\04\74\65\73\74" ;; "test"
2175 "\04\f4\80\80\7f" ;; "\f4\80\80\7f"
2176 "\03" ;; GlobalImport
2177 "\7f" ;; i32
2178 "\00" ;; immutable
2179 )
2180 "invalid UTF-8 encoding"
2181)
2182
2183;; third byte after (0xf4) 4-byte prefix not a continuation byte
2184(assert_malformed
2185 (module binary
2186 "\00asm" "\01\00\00\00"
2187 "\02\0e" ;; import section
2188 "\01" ;; length 1
2189 "\04\74\65\73\74" ;; "test"
2190 "\04\f4\80\80\c0" ;; "\f4\80\80\c0"
2191 "\03" ;; GlobalImport
2192 "\7f" ;; i32
2193 "\00" ;; immutable
2194 )
2195 "invalid UTF-8 encoding"
2196)
2197
2198;; third byte after (0xf4) 4-byte prefix not a continuation byte
2199(assert_malformed
2200 (module binary
2201 "\00asm" "\01\00\00\00"
2202 "\02\0e" ;; import section
2203 "\01" ;; length 1
2204 "\04\74\65\73\74" ;; "test"
2205 "\04\f4\80\80\fd" ;; "\f4\80\80\fd"
2206 "\03" ;; GlobalImport
2207 "\7f" ;; i32
2208 "\00" ;; immutable
2209 )
2210 "invalid UTF-8 encoding"
2211)
2212
2213;;;; 5-byte sequences
2214
2215;; 5-byte sequence contains 6 bytes
2216(assert_malformed
2217 (module binary
2218 "\00asm" "\01\00\00\00"
2219 "\02\10" ;; import section
2220 "\01" ;; length 1
2221 "\04\74\65\73\74" ;; "test"
2222 "\06\f8\80\80\80\80\80" ;; "\f8\80\80\80\80\80"
2223 "\03" ;; GlobalImport
2224 "\7f" ;; i32
2225 "\00" ;; immutable
2226 )
2227 "invalid UTF-8 encoding"
2228)
2229
2230;; 5-byte sequence contains 4 bytes at end of string
2231(assert_malformed
2232 (module binary
2233 "\00asm" "\01\00\00\00"
2234 "\02\0e" ;; import section
2235 "\01" ;; length 1
2236 "\04\74\65\73\74" ;; "test"
2237 "\04\f8\80\80\80" ;; "\f8\80\80\80"
2238 "\03" ;; GlobalImport
2239 "\7f" ;; i32
2240 "\00" ;; immutable
2241 )
2242 "invalid UTF-8 encoding"
2243)
2244
2245;; 5-byte sequence contains 4 bytes
2246(assert_malformed
2247 (module binary
2248 "\00asm" "\01\00\00\00"
2249 "\02\0f" ;; import section
2250 "\01" ;; length 1
2251 "\04\74\65\73\74" ;; "test"
2252 "\05\f8\80\80\80\23" ;; "\f8\80\80\80#"
2253 "\03" ;; GlobalImport
2254 "\7f" ;; i32
2255 "\00" ;; immutable
2256 )
2257 "invalid UTF-8 encoding"
2258)
2259
2260;; 5-byte sequence contains 3 bytes at end of string
2261(assert_malformed
2262 (module binary
2263 "\00asm" "\01\00\00\00"
2264 "\02\0d" ;; import section
2265 "\01" ;; length 1
2266 "\04\74\65\73\74" ;; "test"
2267 "\03\f8\80\80" ;; "\f8\80\80"
2268 "\03" ;; GlobalImport
2269 "\7f" ;; i32
2270 "\00" ;; immutable
2271 )
2272 "invalid UTF-8 encoding"
2273)
2274
2275;; 5-byte sequence contains 3 bytes
2276(assert_malformed
2277 (module binary
2278 "\00asm" "\01\00\00\00"
2279 "\02\0e" ;; import section
2280 "\01" ;; length 1
2281 "\04\74\65\73\74" ;; "test"
2282 "\04\f8\80\80\23" ;; "\f8\80\80#"
2283 "\03" ;; GlobalImport
2284 "\7f" ;; i32
2285 "\00" ;; immutable
2286 )
2287 "invalid UTF-8 encoding"
2288)
2289
2290;; 5-byte sequence contains 2 bytes at end of string
2291(assert_malformed
2292 (module binary
2293 "\00asm" "\01\00\00\00"
2294 "\02\0c" ;; import section
2295 "\01" ;; length 1
2296 "\04\74\65\73\74" ;; "test"
2297 "\02\f8\80" ;; "\f8\80"
2298 "\03" ;; GlobalImport
2299 "\7f" ;; i32
2300 "\00" ;; immutable
2301 )
2302 "invalid UTF-8 encoding"
2303)
2304
2305;; 5-byte sequence contains 2 bytes
2306(assert_malformed
2307 (module binary
2308 "\00asm" "\01\00\00\00"
2309 "\02\0d" ;; import section
2310 "\01" ;; length 1
2311 "\04\74\65\73\74" ;; "test"
2312 "\03\f8\80\23" ;; "\f8\80#"
2313 "\03" ;; GlobalImport
2314 "\7f" ;; i32
2315 "\00" ;; immutable
2316 )
2317 "invalid UTF-8 encoding"
2318)
2319
2320;; 5-byte sequence contains 1 byte at end of string
2321(assert_malformed
2322 (module binary
2323 "\00asm" "\01\00\00\00"
2324 "\02\0b" ;; import section
2325 "\01" ;; length 1
2326 "\04\74\65\73\74" ;; "test"
2327 "\01\f8" ;; "\f8"
2328 "\03" ;; GlobalImport
2329 "\7f" ;; i32
2330 "\00" ;; immutable
2331 )
2332 "invalid UTF-8 encoding"
2333)
2334
2335;; 5-byte sequence contains 1 byte
2336(assert_malformed
2337 (module binary
2338 "\00asm" "\01\00\00\00"
2339 "\02\0c" ;; import section
2340 "\01" ;; length 1
2341 "\04\74\65\73\74" ;; "test"
2342 "\02\f8\23" ;; "\f8#"
2343 "\03" ;; GlobalImport
2344 "\7f" ;; i32
2345 "\00" ;; immutable
2346 )
2347 "invalid UTF-8 encoding"
2348)
2349
2350;;;; 5-byte sequence contents
2351
2352;; (first) invalid 5-byte prefix
2353(assert_malformed
2354 (module binary
2355 "\00asm" "\01\00\00\00"
2356 "\02\0f" ;; import section
2357 "\01" ;; length 1
2358 "\04\74\65\73\74" ;; "test"
2359 "\05\f8\80\80\80\80" ;; "\f8\80\80\80\80"
2360 "\03" ;; GlobalImport
2361 "\7f" ;; i32
2362 "\00" ;; immutable
2363 )
2364 "invalid UTF-8 encoding"
2365)
2366
2367;; (last) invalid 5-byte prefix
2368(assert_malformed
2369 (module binary
2370 "\00asm" "\01\00\00\00"
2371 "\02\0f" ;; import section
2372 "\01" ;; length 1
2373 "\04\74\65\73\74" ;; "test"
2374 "\05\fb\bf\bf\bf\bf" ;; "\fb\bf\bf\bf\bf"
2375 "\03" ;; GlobalImport
2376 "\7f" ;; i32
2377 "\00" ;; immutable
2378 )
2379 "invalid UTF-8 encoding"
2380)
2381
2382;;;; 6-byte sequences
2383
2384;; 6-byte sequence contains 7 bytes
2385(assert_malformed
2386 (module binary
2387 "\00asm" "\01\00\00\00"
2388 "\02\11" ;; import section
2389 "\01" ;; length 1
2390 "\04\74\65\73\74" ;; "test"
2391 "\07\fc\80\80\80\80\80\80" ;; "\fc\80\80\80\80\80\80"
2392 "\03" ;; GlobalImport
2393 "\7f" ;; i32
2394 "\00" ;; immutable
2395 )
2396 "invalid UTF-8 encoding"
2397)
2398
2399;; 6-byte sequence contains 5 bytes at end of string
2400(assert_malformed
2401 (module binary
2402 "\00asm" "\01\00\00\00"
2403 "\02\0f" ;; import section
2404 "\01" ;; length 1
2405 "\04\74\65\73\74" ;; "test"
2406 "\05\fc\80\80\80\80" ;; "\fc\80\80\80\80"
2407 "\03" ;; GlobalImport
2408 "\7f" ;; i32
2409 "\00" ;; immutable
2410 )
2411 "invalid UTF-8 encoding"
2412)
2413
2414;; 6-byte sequence contains 5 bytes
2415(assert_malformed
2416 (module binary
2417 "\00asm" "\01\00\00\00"
2418 "\02\10" ;; import section
2419 "\01" ;; length 1
2420 "\04\74\65\73\74" ;; "test"
2421 "\06\fc\80\80\80\80\23" ;; "\fc\80\80\80\80#"
2422 "\03" ;; GlobalImport
2423 "\7f" ;; i32
2424 "\00" ;; immutable
2425 )
2426 "invalid UTF-8 encoding"
2427)
2428
2429;; 6-byte sequence contains 4 bytes at end of string
2430(assert_malformed
2431 (module binary
2432 "\00asm" "\01\00\00\00"
2433 "\02\0e" ;; import section
2434 "\01" ;; length 1
2435 "\04\74\65\73\74" ;; "test"
2436 "\04\fc\80\80\80" ;; "\fc\80\80\80"
2437 "\03" ;; GlobalImport
2438 "\7f" ;; i32
2439 "\00" ;; immutable
2440 )
2441 "invalid UTF-8 encoding"
2442)
2443
2444;; 6-byte sequence contains 4 bytes
2445(assert_malformed
2446 (module binary
2447 "\00asm" "\01\00\00\00"
2448 "\02\0f" ;; import section
2449 "\01" ;; length 1
2450 "\04\74\65\73\74" ;; "test"
2451 "\05\fc\80\80\80\23" ;; "\fc\80\80\80#"
2452 "\03" ;; GlobalImport
2453 "\7f" ;; i32
2454 "\00" ;; immutable
2455 )
2456 "invalid UTF-8 encoding"
2457)
2458
2459;; 6-byte sequence contains 3 bytes at end of string
2460(assert_malformed
2461 (module binary
2462 "\00asm" "\01\00\00\00"
2463 "\02\0d" ;; import section
2464 "\01" ;; length 1
2465 "\04\74\65\73\74" ;; "test"
2466 "\03\fc\80\80" ;; "\fc\80\80"
2467 "\03" ;; GlobalImport
2468 "\7f" ;; i32
2469 "\00" ;; immutable
2470 )
2471 "invalid UTF-8 encoding"
2472)
2473
2474;; 6-byte sequence contains 3 bytes
2475(assert_malformed
2476 (module binary
2477 "\00asm" "\01\00\00\00"
2478 "\02\0e" ;; import section
2479 "\01" ;; length 1
2480 "\04\74\65\73\74" ;; "test"
2481 "\04\fc\80\80\23" ;; "\fc\80\80#"
2482 "\03" ;; GlobalImport
2483 "\7f" ;; i32
2484 "\00" ;; immutable
2485 )
2486 "invalid UTF-8 encoding"
2487)
2488
2489;; 6-byte sequence contains 2 bytes at end of string
2490(assert_malformed
2491 (module binary
2492 "\00asm" "\01\00\00\00"
2493 "\02\0c" ;; import section
2494 "\01" ;; length 1
2495 "\04\74\65\73\74" ;; "test"
2496 "\02\fc\80" ;; "\fc\80"
2497 "\03" ;; GlobalImport
2498 "\7f" ;; i32
2499 "\00" ;; immutable
2500 )
2501 "invalid UTF-8 encoding"
2502)
2503
2504;; 6-byte sequence contains 2 bytes
2505(assert_malformed
2506 (module binary
2507 "\00asm" "\01\00\00\00"
2508 "\02\0d" ;; import section
2509 "\01" ;; length 1
2510 "\04\74\65\73\74" ;; "test"
2511 "\03\fc\80\23" ;; "\fc\80#"
2512 "\03" ;; GlobalImport
2513 "\7f" ;; i32
2514 "\00" ;; immutable
2515 )
2516 "invalid UTF-8 encoding"
2517)
2518
2519;; 6-byte sequence contains 1 byte at end of string
2520(assert_malformed
2521 (module binary
2522 "\00asm" "\01\00\00\00"
2523 "\02\0b" ;; import section
2524 "\01" ;; length 1
2525 "\04\74\65\73\74" ;; "test"
2526 "\01\fc" ;; "\fc"
2527 "\03" ;; GlobalImport
2528 "\7f" ;; i32
2529 "\00" ;; immutable
2530 )
2531 "invalid UTF-8 encoding"
2532)
2533
2534;; 6-byte sequence contains 1 byte
2535(assert_malformed
2536 (module binary
2537 "\00asm" "\01\00\00\00"
2538 "\02\0c" ;; import section
2539 "\01" ;; length 1
2540 "\04\74\65\73\74" ;; "test"
2541 "\02\fc\23" ;; "\fc#"
2542 "\03" ;; GlobalImport
2543 "\7f" ;; i32
2544 "\00" ;; immutable
2545 )
2546 "invalid UTF-8 encoding"
2547)
2548
2549;;;; 6-byte sequence contents
2550
2551;; (first) invalid 6-byte prefix
2552(assert_malformed
2553 (module binary
2554 "\00asm" "\01\00\00\00"
2555 "\02\10" ;; import section
2556 "\01" ;; length 1
2557 "\04\74\65\73\74" ;; "test"
2558 "\06\fc\80\80\80\80\80" ;; "\fc\80\80\80\80\80"
2559 "\03" ;; GlobalImport
2560 "\7f" ;; i32
2561 "\00" ;; immutable
2562 )
2563 "invalid UTF-8 encoding"
2564)
2565
2566;; (last) invalid 6-byte prefix
2567(assert_malformed
2568 (module binary
2569 "\00asm" "\01\00\00\00"
2570 "\02\10" ;; import section
2571 "\01" ;; length 1
2572 "\04\74\65\73\74" ;; "test"
2573 "\06\fd\bf\bf\bf\bf\bf" ;; "\fd\bf\bf\bf\bf\bf"
2574 "\03" ;; GlobalImport
2575 "\7f" ;; i32
2576 "\00" ;; immutable
2577 )
2578 "invalid UTF-8 encoding"
2579)
2580
2581;;;; Miscellaneous invalid bytes
2582
2583;; invalid byte
2584(assert_malformed
2585 (module binary
2586 "\00asm" "\01\00\00\00"
2587 "\02\0b" ;; import section
2588 "\01" ;; length 1
2589 "\04\74\65\73\74" ;; "test"
2590 "\01\fe" ;; "\fe"
2591 "\03" ;; GlobalImport
2592 "\7f" ;; i32
2593 "\00" ;; immutable
2594 )
2595 "invalid UTF-8 encoding"
2596)
2597
2598;; invalid byte
2599(assert_malformed
2600 (module binary
2601 "\00asm" "\01\00\00\00"
2602 "\02\0b" ;; import section
2603 "\01" ;; length 1
2604 "\04\74\65\73\74" ;; "test"
2605 "\01\ff" ;; "\ff"
2606 "\03" ;; GlobalImport
2607 "\7f" ;; i32
2608 "\00" ;; immutable
2609 )
2610 "invalid UTF-8 encoding"
2611)
2612
2613;; UTF-16BE BOM
2614(assert_malformed
2615 (module binary
2616 "\00asm" "\01\00\00\00"
2617 "\02\0c" ;; import section
2618 "\01" ;; length 1
2619 "\04\74\65\73\74" ;; "test"
2620 "\02\fe\ff" ;; "\fe\ff"
2621 "\03" ;; GlobalImport
2622 "\7f" ;; i32
2623 "\00" ;; immutable
2624 )
2625 "invalid UTF-8 encoding"
2626)
2627
2628;; UTF-32BE BOM
2629(assert_malformed
2630 (module binary
2631 "\00asm" "\01\00\00\00"
2632 "\02\0e" ;; import section
2633 "\01" ;; length 1
2634 "\04\74\65\73\74" ;; "test"
2635 "\04\00\00\fe\ff" ;; "\00\00\fe\ff"
2636 "\03" ;; GlobalImport
2637 "\7f" ;; i32
2638 "\00" ;; immutable
2639 )
2640 "invalid UTF-8 encoding"
2641)
2642
2643;; UTF-16LE BOM
2644(assert_malformed
2645 (module binary
2646 "\00asm" "\01\00\00\00"
2647 "\02\0c" ;; import section
2648 "\01" ;; length 1
2649 "\04\74\65\73\74" ;; "test"
2650 "\02\ff\fe" ;; "\ff\fe"
2651 "\03" ;; GlobalImport
2652 "\7f" ;; i32
2653 "\00" ;; immutable
2654 )
2655 "invalid UTF-8 encoding"
2656)
2657
2658;; UTF-32LE BOM
2659(assert_malformed
2660 (module binary
2661 "\00asm" "\01\00\00\00"
2662 "\02\0e" ;; import section
2663 "\01" ;; length 1
2664 "\04\74\65\73\74" ;; "test"
2665 "\04\ff\fe\00\00" ;; "\ff\fe\00\00"
2666 "\03" ;; GlobalImport
2667 "\7f" ;; i32
2668 "\00" ;; immutable
2669 )
2670 "invalid UTF-8 encoding"
2671)
2672
View as plain text