b2394f5e3ba14913cc1f9b2d84e3bffa774d9bc6
[platform/framework/web/lwnode.git] /
1 (module binary
2   "\00asm" "\01\00\00\00"
3   "\00\24\10" "a custom section" "this is the payload"
4   "\00\20\10" "a custom section" "this is payload"
5   "\00\11\10" "a custom section" ""
6   "\00\10\00" "" "this is payload"
7   "\00\01\00" "" ""
8   "\00\24\10" "\00\00custom sectio\00" "this is the payload"
9   "\00\24\10" "\ef\bb\bfa custom sect" "this is the payload"
10   "\00\24\10" "a custom sect\e2\8c\a3" "this is the payload"
11   "\00\1f\16" "module within a module" "\00asm" "\01\00\00\00"
12 )
13
14 (module binary
15   "\00asm" "\01\00\00\00"
16   "\00\0e\06" "custom" "payload"
17   "\00\0e\06" "custom" "payload"
18   "\01\01\00"  ;; type section
19   "\00\0e\06" "custom" "payload"
20   "\00\0e\06" "custom" "payload"
21   "\02\01\00"  ;; import section
22   "\00\0e\06" "custom" "payload"
23   "\00\0e\06" "custom" "payload"
24   "\03\01\00"  ;; function section
25   "\00\0e\06" "custom" "payload"
26   "\00\0e\06" "custom" "payload"
27   "\04\01\00"  ;; table section
28   "\00\0e\06" "custom" "payload"
29   "\00\0e\06" "custom" "payload"
30   "\05\01\00"  ;; memory section
31   "\00\0e\06" "custom" "payload"
32   "\00\0e\06" "custom" "payload"
33   "\06\01\00"  ;; global section
34   "\00\0e\06" "custom" "payload"
35   "\00\0e\06" "custom" "payload"
36   "\07\01\00"  ;; export section
37   "\00\0e\06" "custom" "payload"
38   "\00\0e\06" "custom" "payload"
39   "\09\01\00"  ;; element section
40   "\00\0e\06" "custom" "payload"
41   "\00\0e\06" "custom" "payload"
42   "\0a\01\00"  ;; code section
43   "\00\0e\06" "custom" "payload"
44   "\00\0e\06" "custom" "payload"
45   "\0b\01\00"  ;; data section
46   "\00\0e\06" "custom" "payload"
47   "\00\0e\06" "custom" "payload"
48 )
49
50 (module binary
51   "\00asm" "\01\00\00\00"
52   "\01\07\01\60\02\7f\7f\01\7f"                ;; type section
53   "\00\1a\06" "custom" "this is the payload"   ;; custom section
54   "\03\02\01\00"                               ;; function section
55   "\07\0a\01\06\61\64\64\54\77\6f\00\00"       ;; export section
56   "\0a\09\01\07\00\20\00\20\01\6a\0b"          ;; code section
57   "\00\1b\07" "custom2" "this is the payload"  ;; custom section
58 )
59
60 (assert_malformed
61   (module binary
62     "\00asm" "\01\00\00\00"
63     "\00"
64   )
65   "unexpected end"
66 )
67
68 (assert_malformed
69   (module binary
70     "\00asm" "\01\00\00\00"
71     "\00\00"
72   )
73   "unexpected end"
74 )
75
76 (assert_malformed
77   (module binary
78     "\00asm" "\01\00\00\00"
79     "\00\00\00\05\01\00\07\00\00"
80   )
81   "unexpected end"
82 )
83
84 (assert_malformed
85   (module binary
86     "\00asm" "\01\00\00\00"
87     "\00\26\10" "a custom section" "this is the payload"
88   )
89   "unexpected end"
90 )
91
92 (assert_malformed
93   (module binary
94     "\00asm" "\01\00\00\00"
95     "\00\25\10" "a custom section" "this is the payload"
96     "\00\24\10" "a custom section" "this is the payload"
97   )
98   "malformed section id"
99 )
100
101 (assert_malformed
102   (module binary
103     "\00asm" "\01\00\00\00"
104     "\01\07\01\60\02\7f\7f\01\7f"                         ;; type section
105     "\00\25\10" "a custom section" "this is the payload"  ;; wrong length!
106     "\03\02\01\00"                                        ;; function section
107     "\0a\09\01\07\00\20\00\20\01\6a\0b"                   ;; code section
108     "\00\1b\07" "custom2" "this is the payload"           ;; custom section
109   )
110   "function and code section have inconsistent lengths"
111 )
112
113 ;; Test concatenated modules.
114 (assert_malformed
115   (module binary
116     "\00asm\01\00\00\00"
117     "\00asm\01\00\00\00"
118   )
119   "length out of bounds"
120 )
121
122 (assert_malformed
123   (module binary
124     "\00asm" "\01\00\00\00"
125     "\05\03\01\00\01"                         ;; memory section
126     "\0c\01\02"                               ;; data count section (2 segments)
127     "\0b\06\01\00\41\00\0b\00"                ;; data section (1 segment)
128   )
129   "data count and data section have inconsistent lengths"
130 )