...
1;;;;;; Invalid UTF-8 custom section 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 "\00\02" ;; custom section
10 "\01\80" ;; "\80"
11 )
12 "invalid UTF-8 encoding"
13)
14
15;; encoding starts with (0x8f) continuation byte
16(assert_malformed
17 (module binary
18 "\00asm" "\01\00\00\00"
19 "\00\02" ;; custom section
20 "\01\8f" ;; "\8f"
21 )
22 "invalid UTF-8 encoding"
23)
24
25;; encoding starts with (0x90) continuation byte
26(assert_malformed
27 (module binary
28 "\00asm" "\01\00\00\00"
29 "\00\02" ;; custom section
30 "\01\90" ;; "\90"
31 )
32 "invalid UTF-8 encoding"
33)
34
35;; encoding starts with (0x9f) continuation byte
36(assert_malformed
37 (module binary
38 "\00asm" "\01\00\00\00"
39 "\00\02" ;; custom section
40 "\01\9f" ;; "\9f"
41 )
42 "invalid UTF-8 encoding"
43)
44
45;; encoding starts with (0xa0) continuation byte
46(assert_malformed
47 (module binary
48 "\00asm" "\01\00\00\00"
49 "\00\02" ;; custom section
50 "\01\a0" ;; "\a0"
51 )
52 "invalid UTF-8 encoding"
53)
54
55;; encoding starts with (last) continuation byte
56(assert_malformed
57 (module binary
58 "\00asm" "\01\00\00\00"
59 "\00\02" ;; custom section
60 "\01\bf" ;; "\bf"
61 )
62 "invalid UTF-8 encoding"
63)
64
65;;;; 2-byte sequences
66
67;; 2-byte sequence contains 3 bytes
68(assert_malformed
69 (module binary
70 "\00asm" "\01\00\00\00"
71 "\00\04" ;; custom section
72 "\03\c2\80\80" ;; "\c2\80\80"
73 )
74 "invalid UTF-8 encoding"
75)
76
77;; 2-byte sequence contains 1 byte at end of string
78(assert_malformed
79 (module binary
80 "\00asm" "\01\00\00\00"
81 "\00\02" ;; custom section
82 "\01\c2" ;; "\c2"
83 )
84 "invalid UTF-8 encoding"
85)
86
87;; 2-byte sequence contains 1 byte
88(assert_malformed
89 (module binary
90 "\00asm" "\01\00\00\00"
91 "\00\03" ;; custom section
92 "\02\c2\2e" ;; "\c2."
93 )
94 "invalid UTF-8 encoding"
95)
96
97;;;; 2-byte sequence contents
98
99;; overlong encoding after 0xc0 prefix
100(assert_malformed
101 (module binary
102 "\00asm" "\01\00\00\00"
103 "\00\03" ;; custom section
104 "\02\c0\80" ;; "\c0\80"
105 )
106 "invalid UTF-8 encoding"
107)
108
109;; overlong encoding after 0xc0 prefix
110(assert_malformed
111 (module binary
112 "\00asm" "\01\00\00\00"
113 "\00\03" ;; custom section
114 "\02\c0\bf" ;; "\c0\bf"
115 )
116 "invalid UTF-8 encoding"
117)
118
119;; overlong encoding after 0xc1 prefix
120(assert_malformed
121 (module binary
122 "\00asm" "\01\00\00\00"
123 "\00\03" ;; custom section
124 "\02\c1\80" ;; "\c1\80"
125 )
126 "invalid UTF-8 encoding"
127)
128
129;; overlong encoding after 0xc1 prefix
130(assert_malformed
131 (module binary
132 "\00asm" "\01\00\00\00"
133 "\00\03" ;; custom section
134 "\02\c1\bf" ;; "\c1\bf"
135 )
136 "invalid UTF-8 encoding"
137)
138
139;; byte after (first) 2-byte prefix not a contination byte
140(assert_malformed
141 (module binary
142 "\00asm" "\01\00\00\00"
143 "\00\03" ;; custom section
144 "\02\c2\00" ;; "\c2\00"
145 )
146 "invalid UTF-8 encoding"
147)
148
149;; byte after (first) 2-byte prefix not a continuation byte
150(assert_malformed
151 (module binary
152 "\00asm" "\01\00\00\00"
153 "\00\03" ;; custom section
154 "\02\c2\7f" ;; "\c2\7f"
155 )
156 "invalid UTF-8 encoding"
157)
158
159;; byte after (first) 2-byte prefix not a continuation byte
160(assert_malformed
161 (module binary
162 "\00asm" "\01\00\00\00"
163 "\00\03" ;; custom section
164 "\02\c2\c0" ;; "\c2\c0"
165 )
166 "invalid UTF-8 encoding"
167)
168
169;; byte after (first) 2-byte prefix not a continuation byte
170(assert_malformed
171 (module binary
172 "\00asm" "\01\00\00\00"
173 "\00\03" ;; custom section
174 "\02\c2\fd" ;; "\c2\fd"
175 )
176 "invalid UTF-8 encoding"
177)
178
179;; byte after (last) 2-byte prefix not a continuation byte
180(assert_malformed
181 (module binary
182 "\00asm" "\01\00\00\00"
183 "\00\03" ;; custom section
184 "\02\df\00" ;; "\df\00"
185 )
186 "invalid UTF-8 encoding"
187)
188
189;; byte after (last) 2-byte prefix not a continuation byte
190(assert_malformed
191 (module binary
192 "\00asm" "\01\00\00\00"
193 "\00\03" ;; custom section
194 "\02\df\7f" ;; "\df\7f"
195 )
196 "invalid UTF-8 encoding"
197)
198
199;; byte after (last) 2-byte prefix not a continuation byte
200(assert_malformed
201 (module binary
202 "\00asm" "\01\00\00\00"
203 "\00\03" ;; custom section
204 "\02\df\c0" ;; "\df\c0"
205 )
206 "invalid UTF-8 encoding"
207)
208
209;; byte after (last) 2-byte prefix not a continuation byte
210(assert_malformed
211 (module binary
212 "\00asm" "\01\00\00\00"
213 "\00\03" ;; custom section
214 "\02\df\fd" ;; "\df\fd"
215 )
216 "invalid UTF-8 encoding"
217)
218
219;;;; 3-byte sequences
220
221;; 3-byte sequence contains 4 bytes
222(assert_malformed
223 (module binary
224 "\00asm" "\01\00\00\00"
225 "\00\05" ;; custom section
226 "\04\e1\80\80\80" ;; "\e1\80\80\80"
227 )
228 "invalid UTF-8 encoding"
229)
230
231;; 3-byte sequence contains 2 bytes at end of string
232(assert_malformed
233 (module binary
234 "\00asm" "\01\00\00\00"
235 "\00\03" ;; custom section
236 "\02\e1\80" ;; "\e1\80"
237 )
238 "invalid UTF-8 encoding"
239)
240
241;; 3-byte sequence contains 2 bytes
242(assert_malformed
243 (module binary
244 "\00asm" "\01\00\00\00"
245 "\00\04" ;; custom section
246 "\03\e1\80\2e" ;; "\e1\80."
247 )
248 "invalid UTF-8 encoding"
249)
250
251;; 3-byte sequence contains 1 byte at end of string
252(assert_malformed
253 (module binary
254 "\00asm" "\01\00\00\00"
255 "\00\02" ;; custom section
256 "\01\e1" ;; "\e1"
257 )
258 "invalid UTF-8 encoding"
259)
260
261;; 3-byte sequence contains 1 byte
262(assert_malformed
263 (module binary
264 "\00asm" "\01\00\00\00"
265 "\00\03" ;; custom section
266 "\02\e1\2e" ;; "\e1."
267 )
268 "invalid UTF-8 encoding"
269)
270
271;;;; 3-byte sequence contents
272
273;; first byte after (0xe0) 3-byte prefix not a continuation byte
274(assert_malformed
275 (module binary
276 "\00asm" "\01\00\00\00"
277 "\00\04" ;; custom section
278 "\03\e0\00\a0" ;; "\e0\00\a0"
279 )
280 "invalid UTF-8 encoding"
281)
282
283;; first byte after (0xe0) 3-byte prefix not a continuation byte
284(assert_malformed
285 (module binary
286 "\00asm" "\01\00\00\00"
287 "\00\04" ;; custom section
288 "\03\e0\7f\a0" ;; "\e0\7f\a0"
289 )
290 "invalid UTF-8 encoding"
291)
292
293;; overlong encoding after 0xe0 prefix
294(assert_malformed
295 (module binary
296 "\00asm" "\01\00\00\00"
297 "\00\04" ;; custom section
298 "\03\e0\80\80" ;; "\e0\80\80"
299 )
300 "invalid UTF-8 encoding"
301)
302
303;; overlong encoding after 0xe0 prefix
304(assert_malformed
305 (module binary
306 "\00asm" "\01\00\00\00"
307 "\00\04" ;; custom section
308 "\03\e0\80\a0" ;; "\e0\80\a0"
309 )
310 "invalid UTF-8 encoding"
311)
312
313;; overlong encoding after 0xe0 prefix
314(assert_malformed
315 (module binary
316 "\00asm" "\01\00\00\00"
317 "\00\04" ;; custom section
318 "\03\e0\9f\a0" ;; "\e0\9f\a0"
319 )
320 "invalid UTF-8 encoding"
321)
322
323;; overlong encoding after 0xe0 prefix
324(assert_malformed
325 (module binary
326 "\00asm" "\01\00\00\00"
327 "\00\04" ;; custom section
328 "\03\e0\9f\bf" ;; "\e0\9f\bf"
329 )
330 "invalid UTF-8 encoding"
331)
332
333;; first byte after (0xe0) 3-byte prefix not a continuation byte
334(assert_malformed
335 (module binary
336 "\00asm" "\01\00\00\00"
337 "\00\04" ;; custom section
338 "\03\e0\c0\a0" ;; "\e0\c0\a0"
339 )
340 "invalid UTF-8 encoding"
341)
342
343;; first byte after (0xe0) 3-byte prefix not a continuation byte
344(assert_malformed
345 (module binary
346 "\00asm" "\01\00\00\00"
347 "\00\04" ;; custom section
348 "\03\e0\fd\a0" ;; "\e0\fd\a0"
349 )
350 "invalid UTF-8 encoding"
351)
352
353;; first byte after (first normal) 3-byte prefix not a continuation byte
354(assert_malformed
355 (module binary
356 "\00asm" "\01\00\00\00"
357 "\00\04" ;; custom section
358 "\03\e1\00\80" ;; "\e1\00\80"
359 )
360 "invalid UTF-8 encoding"
361)
362
363;; first byte after (first normal) 3-byte prefix not a continuation byte
364(assert_malformed
365 (module binary
366 "\00asm" "\01\00\00\00"
367 "\00\04" ;; custom section
368 "\03\e1\7f\80" ;; "\e1\7f\80"
369 )
370 "invalid UTF-8 encoding"
371)
372
373;; first byte after (first normal) 3-byte prefix not a continuation byte
374(assert_malformed
375 (module binary
376 "\00asm" "\01\00\00\00"
377 "\00\04" ;; custom section
378 "\03\e1\c0\80" ;; "\e1\c0\80"
379 )
380 "invalid UTF-8 encoding"
381)
382
383;; first byte after (first normal) 3-byte prefix not a continuation byte
384(assert_malformed
385 (module binary
386 "\00asm" "\01\00\00\00"
387 "\00\04" ;; custom section
388 "\03\e1\fd\80" ;; "\e1\fd\80"
389 )
390 "invalid UTF-8 encoding"
391)
392
393;; first byte after (normal) 3-byte prefix not a continuation byte
394(assert_malformed
395 (module binary
396 "\00asm" "\01\00\00\00"
397 "\00\04" ;; custom section
398 "\03\ec\00\80" ;; "\ec\00\80"
399 )
400 "invalid UTF-8 encoding"
401)
402
403;; first byte after (normal) 3-byte prefix not a continuation byte
404(assert_malformed
405 (module binary
406 "\00asm" "\01\00\00\00"
407 "\00\04" ;; custom section
408 "\03\ec\7f\80" ;; "\ec\7f\80"
409 )
410 "invalid UTF-8 encoding"
411)
412
413;; first byte after (normal) 3-byte prefix not a continuation byte
414(assert_malformed
415 (module binary
416 "\00asm" "\01\00\00\00"
417 "\00\04" ;; custom section
418 "\03\ec\c0\80" ;; "\ec\c0\80"
419 )
420 "invalid UTF-8 encoding"
421)
422
423;; first byte after (normal) 3-byte prefix not a continuation byte
424(assert_malformed
425 (module binary
426 "\00asm" "\01\00\00\00"
427 "\00\04" ;; custom section
428 "\03\ec\fd\80" ;; "\ec\fd\80"
429 )
430 "invalid UTF-8 encoding"
431)
432
433;; first byte after (0xed) 3-byte prefix not a continuation byte
434(assert_malformed
435 (module binary
436 "\00asm" "\01\00\00\00"
437 "\00\04" ;; custom section
438 "\03\ed\00\80" ;; "\ed\00\80"
439 )
440 "invalid UTF-8 encoding"
441)
442
443;; first byte after (0xed) 3-byte prefix not a continuation byte
444(assert_malformed
445 (module binary
446 "\00asm" "\01\00\00\00"
447 "\00\04" ;; custom section
448 "\03\ed\7f\80" ;; "\ed\7f\80"
449 )
450 "invalid UTF-8 encoding"
451)
452
453;; byte sequence reserved for UTF-16 surrogate half
454(assert_malformed
455 (module binary
456 "\00asm" "\01\00\00\00"
457 "\00\04" ;; custom section
458 "\03\ed\a0\80" ;; "\ed\a0\80"
459 )
460 "invalid UTF-8 encoding"
461)
462
463;; byte sequence reserved for UTF-16 surrogate half
464(assert_malformed
465 (module binary
466 "\00asm" "\01\00\00\00"
467 "\00\04" ;; custom section
468 "\03\ed\a0\bf" ;; "\ed\a0\bf"
469 )
470 "invalid UTF-8 encoding"
471)
472
473;; byte sequence reserved for UTF-16 surrogate half
474(assert_malformed
475 (module binary
476 "\00asm" "\01\00\00\00"
477 "\00\04" ;; custom section
478 "\03\ed\bf\80" ;; "\ed\bf\80"
479 )
480 "invalid UTF-8 encoding"
481)
482
483;; byte sequence reserved for UTF-16 surrogate half
484(assert_malformed
485 (module binary
486 "\00asm" "\01\00\00\00"
487 "\00\04" ;; custom section
488 "\03\ed\bf\bf" ;; "\ed\bf\bf"
489 )
490 "invalid UTF-8 encoding"
491)
492
493;; first byte after (0xed) 3-byte prefix not a continuation byte
494(assert_malformed
495 (module binary
496 "\00asm" "\01\00\00\00"
497 "\00\04" ;; custom section
498 "\03\ed\c0\80" ;; "\ed\c0\80"
499 )
500 "invalid UTF-8 encoding"
501)
502
503;; first byte after (0xed) 3-byte prefix not a continuation byte
504(assert_malformed
505 (module binary
506 "\00asm" "\01\00\00\00"
507 "\00\04" ;; custom section
508 "\03\ed\fd\80" ;; "\ed\fd\80"
509 )
510 "invalid UTF-8 encoding"
511)
512
513;; first byte after (normal) 3-byte prefix not a continuation byte
514(assert_malformed
515 (module binary
516 "\00asm" "\01\00\00\00"
517 "\00\04" ;; custom section
518 "\03\ee\00\80" ;; "\ee\00\80"
519 )
520 "invalid UTF-8 encoding"
521)
522
523;; first byte after (normal) 3-byte prefix not a continuation byte
524(assert_malformed
525 (module binary
526 "\00asm" "\01\00\00\00"
527 "\00\04" ;; custom section
528 "\03\ee\7f\80" ;; "\ee\7f\80"
529 )
530 "invalid UTF-8 encoding"
531)
532
533;; first byte after (normal) 3-byte prefix not a continuation byte
534(assert_malformed
535 (module binary
536 "\00asm" "\01\00\00\00"
537 "\00\04" ;; custom section
538 "\03\ee\c0\80" ;; "\ee\c0\80"
539 )
540 "invalid UTF-8 encoding"
541)
542
543;; first byte after (normal) 3-byte prefix not a continuation byte
544(assert_malformed
545 (module binary
546 "\00asm" "\01\00\00\00"
547 "\00\04" ;; custom section
548 "\03\ee\fd\80" ;; "\ee\fd\80"
549 )
550 "invalid UTF-8 encoding"
551)
552
553;; first byte after (last normal) 3-byte prefix not a continuation byte
554(assert_malformed
555 (module binary
556 "\00asm" "\01\00\00\00"
557 "\00\04" ;; custom section
558 "\03\ef\00\80" ;; "\ef\00\80"
559 )
560 "invalid UTF-8 encoding"
561)
562
563;; first byte after (last normal) 3-byte prefix not a continuation byte
564(assert_malformed
565 (module binary
566 "\00asm" "\01\00\00\00"
567 "\00\04" ;; custom section
568 "\03\ef\7f\80" ;; "\ef\7f\80"
569 )
570 "invalid UTF-8 encoding"
571)
572
573;; first byte after (last normal) 3-byte prefix not a continuation byte
574(assert_malformed
575 (module binary
576 "\00asm" "\01\00\00\00"
577 "\00\04" ;; custom section
578 "\03\ef\c0\80" ;; "\ef\c0\80"
579 )
580 "invalid UTF-8 encoding"
581)
582
583;; first byte after (last normal) 3-byte prefix not a continuation byte
584(assert_malformed
585 (module binary
586 "\00asm" "\01\00\00\00"
587 "\00\04" ;; custom section
588 "\03\ef\fd\80" ;; "\ef\fd\80"
589 )
590 "invalid UTF-8 encoding"
591)
592
593;;;; 3-byte sequence contents (third byte)
594
595;; second byte after (0xe0) 3-byte prefix not a continuation byte
596(assert_malformed
597 (module binary
598 "\00asm" "\01\00\00\00"
599 "\00\04" ;; custom section
600 "\03\e0\a0\00" ;; "\e0\a0\00"
601 )
602 "invalid UTF-8 encoding"
603)
604
605;; second byte after (0xe0) 3-byte prefix not a continuation byte
606(assert_malformed
607 (module binary
608 "\00asm" "\01\00\00\00"
609 "\00\04" ;; custom section
610 "\03\e0\a0\7f" ;; "\e0\a0\7f"
611 )
612 "invalid UTF-8 encoding"
613)
614
615;; second byte after (0xe0) 3-byte prefix not a continuation byte
616(assert_malformed
617 (module binary
618 "\00asm" "\01\00\00\00"
619 "\00\04" ;; custom section
620 "\03\e0\a0\c0" ;; "\e0\a0\c0"
621 )
622 "invalid UTF-8 encoding"
623)
624
625;; second byte after (0xe0) 3-byte prefix not a continuation byte
626(assert_malformed
627 (module binary
628 "\00asm" "\01\00\00\00"
629 "\00\04" ;; custom section
630 "\03\e0\a0\fd" ;; "\e0\a0\fd"
631 )
632 "invalid UTF-8 encoding"
633)
634
635;; second byte after (first normal) 3-byte prefix not a continuation byte
636(assert_malformed
637 (module binary
638 "\00asm" "\01\00\00\00"
639 "\00\04" ;; custom section
640 "\03\e1\80\00" ;; "\e1\80\00"
641 )
642 "invalid UTF-8 encoding"
643)
644
645;; second byte after (first normal) 3-byte prefix not a continuation byte
646(assert_malformed
647 (module binary
648 "\00asm" "\01\00\00\00"
649 "\00\04" ;; custom section
650 "\03\e1\80\7f" ;; "\e1\80\7f"
651 )
652 "invalid UTF-8 encoding"
653)
654
655;; second byte after (first normal) 3-byte prefix not a continuation byte
656(assert_malformed
657 (module binary
658 "\00asm" "\01\00\00\00"
659 "\00\04" ;; custom section
660 "\03\e1\80\c0" ;; "\e1\80\c0"
661 )
662 "invalid UTF-8 encoding"
663)
664
665;; second byte after (first normal) 3-byte prefix not a continuation byte
666(assert_malformed
667 (module binary
668 "\00asm" "\01\00\00\00"
669 "\00\04" ;; custom section
670 "\03\e1\80\fd" ;; "\e1\80\fd"
671 )
672 "invalid UTF-8 encoding"
673)
674
675;; second byte after (normal) 3-byte prefix not a continuation byte
676(assert_malformed
677 (module binary
678 "\00asm" "\01\00\00\00"
679 "\00\04" ;; custom section
680 "\03\ec\80\00" ;; "\ec\80\00"
681 )
682 "invalid UTF-8 encoding"
683)
684
685;; second byte after (normal) 3-byte prefix not a continuation byte
686(assert_malformed
687 (module binary
688 "\00asm" "\01\00\00\00"
689 "\00\04" ;; custom section
690 "\03\ec\80\7f" ;; "\ec\80\7f"
691 )
692 "invalid UTF-8 encoding"
693)
694
695;; second byte after (normal) 3-byte prefix not a continuation byte
696(assert_malformed
697 (module binary
698 "\00asm" "\01\00\00\00"
699 "\00\04" ;; custom section
700 "\03\ec\80\c0" ;; "\ec\80\c0"
701 )
702 "invalid UTF-8 encoding"
703)
704
705;; second byte after (normal) 3-byte prefix not a continuation byte
706(assert_malformed
707 (module binary
708 "\00asm" "\01\00\00\00"
709 "\00\04" ;; custom section
710 "\03\ec\80\fd" ;; "\ec\80\fd"
711 )
712 "invalid UTF-8 encoding"
713)
714
715;; second byte after (0xed) 3-byte prefix not a continuation byte
716(assert_malformed
717 (module binary
718 "\00asm" "\01\00\00\00"
719 "\00\04" ;; custom section
720 "\03\ed\80\00" ;; "\ed\80\00"
721 )
722 "invalid UTF-8 encoding"
723)
724
725;; second byte after (0xed) 3-byte prefix not a continuation byte
726(assert_malformed
727 (module binary
728 "\00asm" "\01\00\00\00"
729 "\00\04" ;; custom section
730 "\03\ed\80\7f" ;; "\ed\80\7f"
731 )
732 "invalid UTF-8 encoding"
733)
734
735;; second byte after (0xed) 3-byte prefix not a continuation byte
736(assert_malformed
737 (module binary
738 "\00asm" "\01\00\00\00"
739 "\00\04" ;; custom section
740 "\03\ed\80\c0" ;; "\ed\80\c0"
741 )
742 "invalid UTF-8 encoding"
743)
744
745;; second byte after (0xed) 3-byte prefix not a continuation byte
746(assert_malformed
747 (module binary
748 "\00asm" "\01\00\00\00"
749 "\00\04" ;; custom section
750 "\03\ed\80\fd" ;; "\ed\80\fd"
751 )
752 "invalid UTF-8 encoding"
753)
754
755;; second byte after (normal) 3-byte prefix not a continuation byte
756(assert_malformed
757 (module binary
758 "\00asm" "\01\00\00\00"
759 "\00\04" ;; custom section
760 "\03\ee\80\00" ;; "\ee\80\00"
761 )
762 "invalid UTF-8 encoding"
763)
764
765;; second byte after (normal) 3-byte prefix not a continuation byte
766(assert_malformed
767 (module binary
768 "\00asm" "\01\00\00\00"
769 "\00\04" ;; custom section
770 "\03\ee\80\7f" ;; "\ee\80\7f"
771 )
772 "invalid UTF-8 encoding"
773)
774
775;; second byte after (normal) 3-byte prefix not a continuation byte
776(assert_malformed
777 (module binary
778 "\00asm" "\01\00\00\00"
779 "\00\04" ;; custom section
780 "\03\ee\80\c0" ;; "\ee\80\c0"
781 )
782 "invalid UTF-8 encoding"
783)
784
785;; second byte after (normal) 3-byte prefix not a continuation byte
786(assert_malformed
787 (module binary
788 "\00asm" "\01\00\00\00"
789 "\00\04" ;; custom section
790 "\03\ee\80\fd" ;; "\ee\80\fd"
791 )
792 "invalid UTF-8 encoding"
793)
794
795;; second byte after (last normal) 3-byte prefix not a continuation byte
796(assert_malformed
797 (module binary
798 "\00asm" "\01\00\00\00"
799 "\00\04" ;; custom section
800 "\03\ef\80\00" ;; "\ef\80\00"
801 )
802 "invalid UTF-8 encoding"
803)
804
805;; second byte after (last normal) 3-byte prefix not a continuation byte
806(assert_malformed
807 (module binary
808 "\00asm" "\01\00\00\00"
809 "\00\04" ;; custom section
810 "\03\ef\80\7f" ;; "\ef\80\7f"
811 )
812 "invalid UTF-8 encoding"
813)
814
815;; second byte after (last normal) 3-byte prefix not a continuation byte
816(assert_malformed
817 (module binary
818 "\00asm" "\01\00\00\00"
819 "\00\04" ;; custom section
820 "\03\ef\80\c0" ;; "\ef\80\c0"
821 )
822 "invalid UTF-8 encoding"
823)
824
825;; second byte after (last normal) 3-byte prefix not a continuation byte
826(assert_malformed
827 (module binary
828 "\00asm" "\01\00\00\00"
829 "\00\04" ;; custom section
830 "\03\ef\80\fd" ;; "\ef\80\fd"
831 )
832 "invalid UTF-8 encoding"
833)
834
835;;;; 4-byte sequences
836
837;; 4-byte sequence contains 5 bytes
838(assert_malformed
839 (module binary
840 "\00asm" "\01\00\00\00"
841 "\00\06" ;; custom section
842 "\05\f1\80\80\80\80" ;; "\f1\80\80\80\80"
843 )
844 "invalid UTF-8 encoding"
845)
846
847;; 4-byte sequence contains 3 bytes at end of string
848(assert_malformed
849 (module binary
850 "\00asm" "\01\00\00\00"
851 "\00\04" ;; custom section
852 "\03\f1\80\80" ;; "\f1\80\80"
853 )
854 "invalid UTF-8 encoding"
855)
856
857;; 4-byte sequence contains 3 bytes
858(assert_malformed
859 (module binary
860 "\00asm" "\01\00\00\00"
861 "\00\05" ;; custom section
862 "\04\f1\80\80\23" ;; "\f1\80\80#"
863 )
864 "invalid UTF-8 encoding"
865)
866
867;; 4-byte sequence contains 2 bytes at end of string
868(assert_malformed
869 (module binary
870 "\00asm" "\01\00\00\00"
871 "\00\03" ;; custom section
872 "\02\f1\80" ;; "\f1\80"
873 )
874 "invalid UTF-8 encoding"
875)
876
877;; 4-byte sequence contains 2 bytes
878(assert_malformed
879 (module binary
880 "\00asm" "\01\00\00\00"
881 "\00\04" ;; custom section
882 "\03\f1\80\23" ;; "\f1\80#"
883 )
884 "invalid UTF-8 encoding"
885)
886
887;; 4-byte sequence contains 1 byte at end of string
888(assert_malformed
889 (module binary
890 "\00asm" "\01\00\00\00"
891 "\00\02" ;; custom section
892 "\01\f1" ;; "\f1"
893 )
894 "invalid UTF-8 encoding"
895)
896
897;; 4-byte sequence contains 1 byte
898(assert_malformed
899 (module binary
900 "\00asm" "\01\00\00\00"
901 "\00\03" ;; custom section
902 "\02\f1\23" ;; "\f1#"
903 )
904 "invalid UTF-8 encoding"
905)
906
907;;;; 4-byte sequence contents
908
909;; first byte after (0xf0) 4-byte prefix not a continuation byte
910(assert_malformed
911 (module binary
912 "\00asm" "\01\00\00\00"
913 "\00\05" ;; custom section
914 "\04\f0\00\90\90" ;; "\f0\00\90\90"
915 )
916 "invalid UTF-8 encoding"
917)
918
919;; first byte after (0xf0) 4-byte prefix not a continuation byte
920(assert_malformed
921 (module binary
922 "\00asm" "\01\00\00\00"
923 "\00\05" ;; custom section
924 "\04\f0\7f\90\90" ;; "\f0\7f\90\90"
925 )
926 "invalid UTF-8 encoding"
927)
928
929;; overlong encoding after 0xf0 prefix
930(assert_malformed
931 (module binary
932 "\00asm" "\01\00\00\00"
933 "\00\05" ;; custom section
934 "\04\f0\80\80\80" ;; "\f0\80\80\80"
935 )
936 "invalid UTF-8 encoding"
937)
938
939;; overlong encoding after 0xf0 prefix
940(assert_malformed
941 (module binary
942 "\00asm" "\01\00\00\00"
943 "\00\05" ;; custom section
944 "\04\f0\80\90\90" ;; "\f0\80\90\90"
945 )
946 "invalid UTF-8 encoding"
947)
948
949;; overlong encoding after 0xf0 prefix
950(assert_malformed
951 (module binary
952 "\00asm" "\01\00\00\00"
953 "\00\05" ;; custom section
954 "\04\f0\8f\90\90" ;; "\f0\8f\90\90"
955 )
956 "invalid UTF-8 encoding"
957)
958
959;; overlong encoding after 0xf0 prefix
960(assert_malformed
961 (module binary
962 "\00asm" "\01\00\00\00"
963 "\00\05" ;; custom section
964 "\04\f0\8f\bf\bf" ;; "\f0\8f\bf\bf"
965 )
966 "invalid UTF-8 encoding"
967)
968
969;; first byte after (0xf0) 4-byte prefix not a continuation byte
970(assert_malformed
971 (module binary
972 "\00asm" "\01\00\00\00"
973 "\00\05" ;; custom section
974 "\04\f0\c0\90\90" ;; "\f0\c0\90\90"
975 )
976 "invalid UTF-8 encoding"
977)
978
979;; first byte after (0xf0) 4-byte prefix not a continuation byte
980(assert_malformed
981 (module binary
982 "\00asm" "\01\00\00\00"
983 "\00\05" ;; custom section
984 "\04\f0\fd\90\90" ;; "\f0\fd\90\90"
985 )
986 "invalid UTF-8 encoding"
987)
988
989;; first byte after (first normal) 4-byte prefix not a continuation byte
990(assert_malformed
991 (module binary
992 "\00asm" "\01\00\00\00"
993 "\00\05" ;; custom section
994 "\04\f1\00\80\80" ;; "\f1\00\80\80"
995 )
996 "invalid UTF-8 encoding"
997)
998
999;; first byte after (first normal) 4-byte prefix not a continuation byte
1000(assert_malformed
1001 (module binary
1002 "\00asm" "\01\00\00\00"
1003 "\00\05" ;; custom section
1004 "\04\f1\7f\80\80" ;; "\f1\7f\80\80"
1005 )
1006 "invalid UTF-8 encoding"
1007)
1008
1009;; first byte after (first normal) 4-byte prefix not a continuation byte
1010(assert_malformed
1011 (module binary
1012 "\00asm" "\01\00\00\00"
1013 "\00\05" ;; custom section
1014 "\04\f1\c0\80\80" ;; "\f1\c0\80\80"
1015 )
1016 "invalid UTF-8 encoding"
1017)
1018
1019;; first byte after (first normal) 4-byte prefix not a continuation byte
1020(assert_malformed
1021 (module binary
1022 "\00asm" "\01\00\00\00"
1023 "\00\05" ;; custom section
1024 "\04\f1\fd\80\80" ;; "\f1\fd\80\80"
1025 )
1026 "invalid UTF-8 encoding"
1027)
1028
1029;; first byte after (last normal) 4-byte prefix not a continuation byte
1030(assert_malformed
1031 (module binary
1032 "\00asm" "\01\00\00\00"
1033 "\00\05" ;; custom section
1034 "\04\f3\00\80\80" ;; "\f3\00\80\80"
1035 )
1036 "invalid UTF-8 encoding"
1037)
1038
1039;; first byte after (last normal) 4-byte prefix not a continuation byte
1040(assert_malformed
1041 (module binary
1042 "\00asm" "\01\00\00\00"
1043 "\00\05" ;; custom section
1044 "\04\f3\7f\80\80" ;; "\f3\7f\80\80"
1045 )
1046 "invalid UTF-8 encoding"
1047)
1048
1049;; first byte after (last normal) 4-byte prefix not a continuation byte
1050(assert_malformed
1051 (module binary
1052 "\00asm" "\01\00\00\00"
1053 "\00\05" ;; custom section
1054 "\04\f3\c0\80\80" ;; "\f3\c0\80\80"
1055 )
1056 "invalid UTF-8 encoding"
1057)
1058
1059;; first byte after (last normal) 4-byte prefix not a continuation byte
1060(assert_malformed
1061 (module binary
1062 "\00asm" "\01\00\00\00"
1063 "\00\05" ;; custom section
1064 "\04\f3\fd\80\80" ;; "\f3\fd\80\80"
1065 )
1066 "invalid UTF-8 encoding"
1067)
1068
1069;; first byte after (0xf4) 4-byte prefix not a continuation byte
1070(assert_malformed
1071 (module binary
1072 "\00asm" "\01\00\00\00"
1073 "\00\05" ;; custom section
1074 "\04\f4\00\80\80" ;; "\f4\00\80\80"
1075 )
1076 "invalid UTF-8 encoding"
1077)
1078
1079;; first byte after (0xf4) 4-byte prefix not a continuation byte
1080(assert_malformed
1081 (module binary
1082 "\00asm" "\01\00\00\00"
1083 "\00\05" ;; custom section
1084 "\04\f4\7f\80\80" ;; "\f4\7f\80\80"
1085 )
1086 "invalid UTF-8 encoding"
1087)
1088
1089;; (first) invalid code point
1090(assert_malformed
1091 (module binary
1092 "\00asm" "\01\00\00\00"
1093 "\00\05" ;; custom section
1094 "\04\f4\90\80\80" ;; "\f4\90\80\80"
1095 )
1096 "invalid UTF-8 encoding"
1097)
1098
1099;; invalid code point
1100(assert_malformed
1101 (module binary
1102 "\00asm" "\01\00\00\00"
1103 "\00\05" ;; custom section
1104 "\04\f4\bf\80\80" ;; "\f4\bf\80\80"
1105 )
1106 "invalid UTF-8 encoding"
1107)
1108
1109;; first byte after (0xf4) 4-byte prefix not a continuation byte
1110(assert_malformed
1111 (module binary
1112 "\00asm" "\01\00\00\00"
1113 "\00\05" ;; custom section
1114 "\04\f4\c0\80\80" ;; "\f4\c0\80\80"
1115 )
1116 "invalid UTF-8 encoding"
1117)
1118
1119;; first byte after (0xf4) 4-byte prefix not a continuation byte
1120(assert_malformed
1121 (module binary
1122 "\00asm" "\01\00\00\00"
1123 "\00\05" ;; custom section
1124 "\04\f4\fd\80\80" ;; "\f4\fd\80\80"
1125 )
1126 "invalid UTF-8 encoding"
1127)
1128
1129;; (first) invalid 4-byte prefix
1130(assert_malformed
1131 (module binary
1132 "\00asm" "\01\00\00\00"
1133 "\00\05" ;; custom section
1134 "\04\f5\80\80\80" ;; "\f5\80\80\80"
1135 )
1136 "invalid UTF-8 encoding"
1137)
1138
1139;; (last) invalid 4-byte prefix
1140(assert_malformed
1141 (module binary
1142 "\00asm" "\01\00\00\00"
1143 "\00\05" ;; custom section
1144 "\04\f7\80\80\80" ;; "\f7\80\80\80"
1145 )
1146 "invalid UTF-8 encoding"
1147)
1148
1149;; (last) invalid 4-byte prefix
1150(assert_malformed
1151 (module binary
1152 "\00asm" "\01\00\00\00"
1153 "\00\05" ;; custom section
1154 "\04\f7\bf\bf\bf" ;; "\f7\bf\bf\bf"
1155 )
1156 "invalid UTF-8 encoding"
1157)
1158
1159;;;; 4-byte sequence contents (third byte)
1160
1161;; second byte after (0xf0) 4-byte prefix not a continuation byte
1162(assert_malformed
1163 (module binary
1164 "\00asm" "\01\00\00\00"
1165 "\00\05" ;; custom section
1166 "\04\f0\90\00\90" ;; "\f0\90\00\90"
1167 )
1168 "invalid UTF-8 encoding"
1169)
1170
1171;; second byte after (0xf0) 4-byte prefix not a continuation byte
1172(assert_malformed
1173 (module binary
1174 "\00asm" "\01\00\00\00"
1175 "\00\05" ;; custom section
1176 "\04\f0\90\7f\90" ;; "\f0\90\7f\90"
1177 )
1178 "invalid UTF-8 encoding"
1179)
1180
1181;; second byte after (0xf0) 4-byte prefix not a continuation byte
1182(assert_malformed
1183 (module binary
1184 "\00asm" "\01\00\00\00"
1185 "\00\05" ;; custom section
1186 "\04\f0\90\c0\90" ;; "\f0\90\c0\90"
1187 )
1188 "invalid UTF-8 encoding"
1189)
1190
1191;; second byte after (0xf0) 4-byte prefix not a continuation byte
1192(assert_malformed
1193 (module binary
1194 "\00asm" "\01\00\00\00"
1195 "\00\05" ;; custom section
1196 "\04\f0\90\fd\90" ;; "\f0\90\fd\90"
1197 )
1198 "invalid UTF-8 encoding"
1199)
1200
1201;; second byte after (first normal) 4-byte prefix not a continuation byte
1202(assert_malformed
1203 (module binary
1204 "\00asm" "\01\00\00\00"
1205 "\00\05" ;; custom section
1206 "\04\f1\80\00\80" ;; "\f1\80\00\80"
1207 )
1208 "invalid UTF-8 encoding"
1209)
1210
1211;; second byte after (first normal) 4-byte prefix not a continuation byte
1212(assert_malformed
1213 (module binary
1214 "\00asm" "\01\00\00\00"
1215 "\00\05" ;; custom section
1216 "\04\f1\80\7f\80" ;; "\f1\80\7f\80"
1217 )
1218 "invalid UTF-8 encoding"
1219)
1220
1221;; second byte after (first normal) 4-byte prefix not a continuation byte
1222(assert_malformed
1223 (module binary
1224 "\00asm" "\01\00\00\00"
1225 "\00\05" ;; custom section
1226 "\04\f1\80\c0\80" ;; "\f1\80\c0\80"
1227 )
1228 "invalid UTF-8 encoding"
1229)
1230
1231;; second byte after (first normal) 4-byte prefix not a continuation byte
1232(assert_malformed
1233 (module binary
1234 "\00asm" "\01\00\00\00"
1235 "\00\05" ;; custom section
1236 "\04\f1\80\fd\80" ;; "\f1\80\fd\80"
1237 )
1238 "invalid UTF-8 encoding"
1239)
1240
1241;; second byte after (last normal) 4-byte prefix not a continuation byte
1242(assert_malformed
1243 (module binary
1244 "\00asm" "\01\00\00\00"
1245 "\00\05" ;; custom section
1246 "\04\f3\80\00\80" ;; "\f3\80\00\80"
1247 )
1248 "invalid UTF-8 encoding"
1249)
1250
1251;; second byte after (last normal) 4-byte prefix not a continuation byte
1252(assert_malformed
1253 (module binary
1254 "\00asm" "\01\00\00\00"
1255 "\00\05" ;; custom section
1256 "\04\f3\80\7f\80" ;; "\f3\80\7f\80"
1257 )
1258 "invalid UTF-8 encoding"
1259)
1260
1261;; second byte after (last normal) 4-byte prefix not a continuation byte
1262(assert_malformed
1263 (module binary
1264 "\00asm" "\01\00\00\00"
1265 "\00\05" ;; custom section
1266 "\04\f3\80\c0\80" ;; "\f3\80\c0\80"
1267 )
1268 "invalid UTF-8 encoding"
1269)
1270
1271;; second byte after (last normal) 4-byte prefix not a continuation byte
1272(assert_malformed
1273 (module binary
1274 "\00asm" "\01\00\00\00"
1275 "\00\05" ;; custom section
1276 "\04\f3\80\fd\80" ;; "\f3\80\fd\80"
1277 )
1278 "invalid UTF-8 encoding"
1279)
1280
1281;; second byte after (0xf4) 4-byte prefix not a continuation byte
1282(assert_malformed
1283 (module binary
1284 "\00asm" "\01\00\00\00"
1285 "\00\05" ;; custom section
1286 "\04\f4\80\00\80" ;; "\f4\80\00\80"
1287 )
1288 "invalid UTF-8 encoding"
1289)
1290
1291;; second byte after (0xf4) 4-byte prefix not a continuation byte
1292(assert_malformed
1293 (module binary
1294 "\00asm" "\01\00\00\00"
1295 "\00\05" ;; custom section
1296 "\04\f4\80\7f\80" ;; "\f4\80\7f\80"
1297 )
1298 "invalid UTF-8 encoding"
1299)
1300
1301;; second byte after (0xf4) 4-byte prefix not a continuation byte
1302(assert_malformed
1303 (module binary
1304 "\00asm" "\01\00\00\00"
1305 "\00\05" ;; custom section
1306 "\04\f4\80\c0\80" ;; "\f4\80\c0\80"
1307 )
1308 "invalid UTF-8 encoding"
1309)
1310
1311;; second byte after (0xf4) 4-byte prefix not a continuation byte
1312(assert_malformed
1313 (module binary
1314 "\00asm" "\01\00\00\00"
1315 "\00\05" ;; custom section
1316 "\04\f4\80\fd\80" ;; "\f4\80\fd\80"
1317 )
1318 "invalid UTF-8 encoding"
1319)
1320
1321;;;; 4-byte sequence contents (fourth byte)
1322
1323;; third byte after (0xf0) 4-byte prefix not a continuation byte
1324(assert_malformed
1325 (module binary
1326 "\00asm" "\01\00\00\00"
1327 "\00\05" ;; custom section
1328 "\04\f0\90\90\00" ;; "\f0\90\90\00"
1329 )
1330 "invalid UTF-8 encoding"
1331)
1332
1333;; third byte after (0xf0) 4-byte prefix not a continuation byte
1334(assert_malformed
1335 (module binary
1336 "\00asm" "\01\00\00\00"
1337 "\00\05" ;; custom section
1338 "\04\f0\90\90\7f" ;; "\f0\90\90\7f"
1339 )
1340 "invalid UTF-8 encoding"
1341)
1342
1343;; third byte after (0xf0) 4-byte prefix not a continuation byte
1344(assert_malformed
1345 (module binary
1346 "\00asm" "\01\00\00\00"
1347 "\00\05" ;; custom section
1348 "\04\f0\90\90\c0" ;; "\f0\90\90\c0"
1349 )
1350 "invalid UTF-8 encoding"
1351)
1352
1353;; third byte after (0xf0) 4-byte prefix not a continuation byte
1354(assert_malformed
1355 (module binary
1356 "\00asm" "\01\00\00\00"
1357 "\00\05" ;; custom section
1358 "\04\f0\90\90\fd" ;; "\f0\90\90\fd"
1359 )
1360 "invalid UTF-8 encoding"
1361)
1362
1363;; third byte after (first normal) 4-byte prefix not a continuation byte
1364(assert_malformed
1365 (module binary
1366 "\00asm" "\01\00\00\00"
1367 "\00\05" ;; custom section
1368 "\04\f1\80\80\00" ;; "\f1\80\80\00"
1369 )
1370 "invalid UTF-8 encoding"
1371)
1372
1373;; third byte after (first normal) 4-byte prefix not a continuation byte
1374(assert_malformed
1375 (module binary
1376 "\00asm" "\01\00\00\00"
1377 "\00\05" ;; custom section
1378 "\04\f1\80\80\7f" ;; "\f1\80\80\7f"
1379 )
1380 "invalid UTF-8 encoding"
1381)
1382
1383;; third byte after (first normal) 4-byte prefix not a continuation byte
1384(assert_malformed
1385 (module binary
1386 "\00asm" "\01\00\00\00"
1387 "\00\05" ;; custom section
1388 "\04\f1\80\80\c0" ;; "\f1\80\80\c0"
1389 )
1390 "invalid UTF-8 encoding"
1391)
1392
1393;; third byte after (first normal) 4-byte prefix not a continuation byte
1394(assert_malformed
1395 (module binary
1396 "\00asm" "\01\00\00\00"
1397 "\00\05" ;; custom section
1398 "\04\f1\80\80\fd" ;; "\f1\80\80\fd"
1399 )
1400 "invalid UTF-8 encoding"
1401)
1402
1403;; third byte after (last normal) 4-byte prefix not a continuation byte
1404(assert_malformed
1405 (module binary
1406 "\00asm" "\01\00\00\00"
1407 "\00\05" ;; custom section
1408 "\04\f3\80\80\00" ;; "\f3\80\80\00"
1409 )
1410 "invalid UTF-8 encoding"
1411)
1412
1413;; third byte after (last normal) 4-byte prefix not a continuation byte
1414(assert_malformed
1415 (module binary
1416 "\00asm" "\01\00\00\00"
1417 "\00\05" ;; custom section
1418 "\04\f3\80\80\7f" ;; "\f3\80\80\7f"
1419 )
1420 "invalid UTF-8 encoding"
1421)
1422
1423;; third byte after (last normal) 4-byte prefix not a continuation byte
1424(assert_malformed
1425 (module binary
1426 "\00asm" "\01\00\00\00"
1427 "\00\05" ;; custom section
1428 "\04\f3\80\80\c0" ;; "\f3\80\80\c0"
1429 )
1430 "invalid UTF-8 encoding"
1431)
1432
1433;; third byte after (last normal) 4-byte prefix not a continuation byte
1434(assert_malformed
1435 (module binary
1436 "\00asm" "\01\00\00\00"
1437 "\00\05" ;; custom section
1438 "\04\f3\80\80\fd" ;; "\f3\80\80\fd"
1439 )
1440 "invalid UTF-8 encoding"
1441)
1442
1443;; third byte after (0xf4) 4-byte prefix not a continuation byte
1444(assert_malformed
1445 (module binary
1446 "\00asm" "\01\00\00\00"
1447 "\00\05" ;; custom section
1448 "\04\f4\80\80\00" ;; "\f4\80\80\00"
1449 )
1450 "invalid UTF-8 encoding"
1451)
1452
1453;; third byte after (0xf4) 4-byte prefix not a continuation byte
1454(assert_malformed
1455 (module binary
1456 "\00asm" "\01\00\00\00"
1457 "\00\05" ;; custom section
1458 "\04\f4\80\80\7f" ;; "\f4\80\80\7f"
1459 )
1460 "invalid UTF-8 encoding"
1461)
1462
1463;; third byte after (0xf4) 4-byte prefix not a continuation byte
1464(assert_malformed
1465 (module binary
1466 "\00asm" "\01\00\00\00"
1467 "\00\05" ;; custom section
1468 "\04\f4\80\80\c0" ;; "\f4\80\80\c0"
1469 )
1470 "invalid UTF-8 encoding"
1471)
1472
1473;; third byte after (0xf4) 4-byte prefix not a continuation byte
1474(assert_malformed
1475 (module binary
1476 "\00asm" "\01\00\00\00"
1477 "\00\05" ;; custom section
1478 "\04\f4\80\80\fd" ;; "\f4\80\80\fd"
1479 )
1480 "invalid UTF-8 encoding"
1481)
1482
1483;;;; 5-byte sequences
1484
1485;; 5-byte sequence contains 6 bytes
1486(assert_malformed
1487 (module binary
1488 "\00asm" "\01\00\00\00"
1489 "\00\07" ;; custom section
1490 "\06\f8\80\80\80\80\80" ;; "\f8\80\80\80\80\80"
1491 )
1492 "invalid UTF-8 encoding"
1493)
1494
1495;; 5-byte sequence contains 4 bytes at end of string
1496(assert_malformed
1497 (module binary
1498 "\00asm" "\01\00\00\00"
1499 "\00\05" ;; custom section
1500 "\04\f8\80\80\80" ;; "\f8\80\80\80"
1501 )
1502 "invalid UTF-8 encoding"
1503)
1504
1505;; 5-byte sequence contains 4 bytes
1506(assert_malformed
1507 (module binary
1508 "\00asm" "\01\00\00\00"
1509 "\00\06" ;; custom section
1510 "\05\f8\80\80\80\23" ;; "\f8\80\80\80#"
1511 )
1512 "invalid UTF-8 encoding"
1513)
1514
1515;; 5-byte sequence contains 3 bytes at end of string
1516(assert_malformed
1517 (module binary
1518 "\00asm" "\01\00\00\00"
1519 "\00\04" ;; custom section
1520 "\03\f8\80\80" ;; "\f8\80\80"
1521 )
1522 "invalid UTF-8 encoding"
1523)
1524
1525;; 5-byte sequence contains 3 bytes
1526(assert_malformed
1527 (module binary
1528 "\00asm" "\01\00\00\00"
1529 "\00\05" ;; custom section
1530 "\04\f8\80\80\23" ;; "\f8\80\80#"
1531 )
1532 "invalid UTF-8 encoding"
1533)
1534
1535;; 5-byte sequence contains 2 bytes at end of string
1536(assert_malformed
1537 (module binary
1538 "\00asm" "\01\00\00\00"
1539 "\00\03" ;; custom section
1540 "\02\f8\80" ;; "\f8\80"
1541 )
1542 "invalid UTF-8 encoding"
1543)
1544
1545;; 5-byte sequence contains 2 bytes
1546(assert_malformed
1547 (module binary
1548 "\00asm" "\01\00\00\00"
1549 "\00\04" ;; custom section
1550 "\03\f8\80\23" ;; "\f8\80#"
1551 )
1552 "invalid UTF-8 encoding"
1553)
1554
1555;; 5-byte sequence contains 1 byte at end of string
1556(assert_malformed
1557 (module binary
1558 "\00asm" "\01\00\00\00"
1559 "\00\02" ;; custom section
1560 "\01\f8" ;; "\f8"
1561 )
1562 "invalid UTF-8 encoding"
1563)
1564
1565;; 5-byte sequence contains 1 byte
1566(assert_malformed
1567 (module binary
1568 "\00asm" "\01\00\00\00"
1569 "\00\03" ;; custom section
1570 "\02\f8\23" ;; "\f8#"
1571 )
1572 "invalid UTF-8 encoding"
1573)
1574
1575;;;; 5-byte sequence contents
1576
1577;; (first) invalid 5-byte prefix
1578(assert_malformed
1579 (module binary
1580 "\00asm" "\01\00\00\00"
1581 "\00\06" ;; custom section
1582 "\05\f8\80\80\80\80" ;; "\f8\80\80\80\80"
1583 )
1584 "invalid UTF-8 encoding"
1585)
1586
1587;; (last) invalid 5-byte prefix
1588(assert_malformed
1589 (module binary
1590 "\00asm" "\01\00\00\00"
1591 "\00\06" ;; custom section
1592 "\05\fb\bf\bf\bf\bf" ;; "\fb\bf\bf\bf\bf"
1593 )
1594 "invalid UTF-8 encoding"
1595)
1596
1597;;;; 6-byte sequences
1598
1599;; 6-byte sequence contains 7 bytes
1600(assert_malformed
1601 (module binary
1602 "\00asm" "\01\00\00\00"
1603 "\00\08" ;; custom section
1604 "\07\fc\80\80\80\80\80\80" ;; "\fc\80\80\80\80\80\80"
1605 )
1606 "invalid UTF-8 encoding"
1607)
1608
1609;; 6-byte sequence contains 5 bytes at end of string
1610(assert_malformed
1611 (module binary
1612 "\00asm" "\01\00\00\00"
1613 "\00\06" ;; custom section
1614 "\05\fc\80\80\80\80" ;; "\fc\80\80\80\80"
1615 )
1616 "invalid UTF-8 encoding"
1617)
1618
1619;; 6-byte sequence contains 5 bytes
1620(assert_malformed
1621 (module binary
1622 "\00asm" "\01\00\00\00"
1623 "\00\07" ;; custom section
1624 "\06\fc\80\80\80\80\23" ;; "\fc\80\80\80\80#"
1625 )
1626 "invalid UTF-8 encoding"
1627)
1628
1629;; 6-byte sequence contains 4 bytes at end of string
1630(assert_malformed
1631 (module binary
1632 "\00asm" "\01\00\00\00"
1633 "\00\05" ;; custom section
1634 "\04\fc\80\80\80" ;; "\fc\80\80\80"
1635 )
1636 "invalid UTF-8 encoding"
1637)
1638
1639;; 6-byte sequence contains 4 bytes
1640(assert_malformed
1641 (module binary
1642 "\00asm" "\01\00\00\00"
1643 "\00\06" ;; custom section
1644 "\05\fc\80\80\80\23" ;; "\fc\80\80\80#"
1645 )
1646 "invalid UTF-8 encoding"
1647)
1648
1649;; 6-byte sequence contains 3 bytes at end of string
1650(assert_malformed
1651 (module binary
1652 "\00asm" "\01\00\00\00"
1653 "\00\04" ;; custom section
1654 "\03\fc\80\80" ;; "\fc\80\80"
1655 )
1656 "invalid UTF-8 encoding"
1657)
1658
1659;; 6-byte sequence contains 3 bytes
1660(assert_malformed
1661 (module binary
1662 "\00asm" "\01\00\00\00"
1663 "\00\05" ;; custom section
1664 "\04\fc\80\80\23" ;; "\fc\80\80#"
1665 )
1666 "invalid UTF-8 encoding"
1667)
1668
1669;; 6-byte sequence contains 2 bytes at end of string
1670(assert_malformed
1671 (module binary
1672 "\00asm" "\01\00\00\00"
1673 "\00\03" ;; custom section
1674 "\02\fc\80" ;; "\fc\80"
1675 )
1676 "invalid UTF-8 encoding"
1677)
1678
1679;; 6-byte sequence contains 2 bytes
1680(assert_malformed
1681 (module binary
1682 "\00asm" "\01\00\00\00"
1683 "\00\04" ;; custom section
1684 "\03\fc\80\23" ;; "\fc\80#"
1685 )
1686 "invalid UTF-8 encoding"
1687)
1688
1689;; 6-byte sequence contains 1 byte at end of string
1690(assert_malformed
1691 (module binary
1692 "\00asm" "\01\00\00\00"
1693 "\00\02" ;; custom section
1694 "\01\fc" ;; "\fc"
1695 )
1696 "invalid UTF-8 encoding"
1697)
1698
1699;; 6-byte sequence contains 1 byte
1700(assert_malformed
1701 (module binary
1702 "\00asm" "\01\00\00\00"
1703 "\00\03" ;; custom section
1704 "\02\fc\23" ;; "\fc#"
1705 )
1706 "invalid UTF-8 encoding"
1707)
1708
1709;;;; 6-byte sequence contents
1710
1711;; (first) invalid 6-byte prefix
1712(assert_malformed
1713 (module binary
1714 "\00asm" "\01\00\00\00"
1715 "\00\07" ;; custom section
1716 "\06\fc\80\80\80\80\80" ;; "\fc\80\80\80\80\80"
1717 )
1718 "invalid UTF-8 encoding"
1719)
1720
1721;; (last) invalid 6-byte prefix
1722(assert_malformed
1723 (module binary
1724 "\00asm" "\01\00\00\00"
1725 "\00\07" ;; custom section
1726 "\06\fd\bf\bf\bf\bf\bf" ;; "\fd\bf\bf\bf\bf\bf"
1727 )
1728 "invalid UTF-8 encoding"
1729)
1730
1731;;;; Miscellaneous invalid bytes
1732
1733;; invalid byte
1734(assert_malformed
1735 (module binary
1736 "\00asm" "\01\00\00\00"
1737 "\00\02" ;; custom section
1738 "\01\fe" ;; "\fe"
1739 )
1740 "invalid UTF-8 encoding"
1741)
1742
1743;; invalid byte
1744(assert_malformed
1745 (module binary
1746 "\00asm" "\01\00\00\00"
1747 "\00\02" ;; custom section
1748 "\01\ff" ;; "\ff"
1749 )
1750 "invalid UTF-8 encoding"
1751)
1752
1753;; UTF-16BE BOM
1754(assert_malformed
1755 (module binary
1756 "\00asm" "\01\00\00\00"
1757 "\00\03" ;; custom section
1758 "\02\fe\ff" ;; "\fe\ff"
1759 )
1760 "invalid UTF-8 encoding"
1761)
1762
1763;; UTF-32BE BOM
1764(assert_malformed
1765 (module binary
1766 "\00asm" "\01\00\00\00"
1767 "\00\05" ;; custom section
1768 "\04\00\00\fe\ff" ;; "\00\00\fe\ff"
1769 )
1770 "invalid UTF-8 encoding"
1771)
1772
1773;; UTF-16LE BOM
1774(assert_malformed
1775 (module binary
1776 "\00asm" "\01\00\00\00"
1777 "\00\03" ;; custom section
1778 "\02\ff\fe" ;; "\ff\fe"
1779 )
1780 "invalid UTF-8 encoding"
1781)
1782
1783;; UTF-32LE BOM
1784(assert_malformed
1785 (module binary
1786 "\00asm" "\01\00\00\00"
1787 "\00\05" ;; custom section
1788 "\04\ff\fe\00\00" ;; "\ff\fe\00\00"
1789 )
1790 "invalid UTF-8 encoding"
1791)
1792
View as plain text