2009-05-19 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / tests / metadata-verifier / data-directory-tests.md
1 pe-data-directories-export-table {
2         #Simple assembly has 2 sections since it doesn't have any resources
3         assembly simple-assembly.exe
4
5         #zero is fine
6         valid offset pe-optional-header + 96 set-uint 0 
7         valid offset pe-optional-header + 100 set-uint 0
8
9         #RVA must be zero
10         invalid offset pe-optional-header + 96 set-uint 0x2000 , offset pe-optional-header + 100 set-uint 10 
11 }
12
13
14 pe-data-directories-import-table {
15         #Simple assembly has 2 sections since it doesn't have any resources
16         assembly simple-assembly.exe
17         
18         #The IT is 40 bytes long
19         invalid offset pe-optional-header + 108 set-uint 0
20         invalid offset pe-optional-header + 108 set-uint 8
21         invalid offset pe-optional-header + 108 set-uint 0x10
22         invalid offset pe-optional-header + 108 set-uint 0x20
23         invalid offset pe-optional-header + 108 set-uint 0x27
24         valid offset pe-optional-header + 108 set-uint 0x28
25
26         #RVA + size must bounds check against the size of the entry.
27         invalid offset pe-optional-header + 108 set-uint 0x900
28 }
29
30 pe-data-directories-bad-tables {
31         #Simple assembly has 2 sections since it doesn't have any resources
32         assembly simple-assembly.exe
33
34         #export
35         invalid offset pe-optional-header + 96 set-uint 0x2000
36
37         #exception 
38         invalid offset pe-optional-header + 120 set-uint 0x2000 
39
40         #certificate  some assemblies have it.
41         #invalid offset pe-optional-header + 128 set-uint 0x2000 
42
43         #debug MS uses it for putting debug info in the assembly 
44         #invalid offset pe-optional-header + 144 set-uint 0x2000 
45
46         #copyright 
47         invalid offset pe-optional-header + 152 set-uint 0x2000 
48
49         #global ptr 
50         invalid offset pe-optional-header + 160 set-uint 0x2000 
51
52         #tls table 
53         invalid offset pe-optional-header + 168 set-uint 0x2000 
54
55         #load config 
56         invalid offset pe-optional-header + 176 set-uint 0x2000 
57
58         #bound import 
59         invalid offset pe-optional-header + 184 set-uint 0x2000 
60
61         #delay import
62         invalid offset pe-optional-header + 200 set-uint 0x2000 
63
64         #reserved import
65         invalid offset pe-optional-header + 216 set-uint 0x2000 
66 }
67
68
69 pe-import-table {
70         #Simple assembly has 2 sections since it doesn't have any resources
71         assembly simple-assembly.exe
72
73         #Invalid rva for the import lookup table
74         invalid offset translate.rva.ind ( pe-optional-header + 104 ) + 0 set-uint 0x88888
75         #Invalid rva for the name
76         invalid offset translate.rva.ind ( pe-optional-header + 104 ) + 12 set-uint 0x88888
77         #Invalid rva for the import address table
78         invalid offset translate.rva.ind ( pe-optional-header + 104 ) + 16 set-uint 0x88888
79 }
80
81 pe-import-table-ILT {
82         #Simple assembly has 2 sections since it doesn't have any resources
83         assembly simple-assembly.exe
84
85         #Bad RVA for the Hint/Name table
86         invalid offset translate.rva.ind ( translate.rva.ind ( pe-optional-header + 104 ) + 0 ) set-uint 0x88888
87
88         #Bad content in the Hint/Name table
89         invalid offset translate.rva.ind ( translate.rva.ind ( translate.rva.ind ( pe-optional-header + 104 ) ) ) + 2 set-uint 0x454c
90 }
91
92 pe-import-table-IAT {
93         #Simple assembly has 2 sections since it doesn't have any resources
94         assembly simple-assembly.exe
95
96         #Bad RVA for the Hint/Name table
97         #LAMEIMPL - MS ignores this
98         invalid offset translate.rva.ind ( translate.rva.ind ( pe-optional-header + 104 ) + 16 ) set-uint 0x88888
99
100         #Bad content in the Hint/Name table
101         invalid offset translate.rva.ind ( translate.rva.ind ( translate.rva.ind ( pe-optional-header + 104 ) + 16 ) ) + 2 set-uint 0x454c
102 }
103
104 pe-import-table-name {
105         #Simple assembly has 2 sections since it doesn't have any resources
106         assembly simple-assembly.exe
107
108         #Invalid symbol name
109         invalid offset translate.rva.ind ( translate.rva.ind ( pe-optional-header + 104 ) + 12 ) set-uint 0x454c
110 }
111
112 pe-IAT {
113         #Simple assembly has 2 sections since it doesn't have any resources
114         assembly simple-assembly.exe
115
116         #Bad RVA to the Hint/Name table
117         #LAMEIMPL - MS ignores this
118         invalid offset translate.rva.ind ( pe-optional-header + 192 ) set-uint 0x88880
119
120         #Bad content in the Hint/Name table
121         invalid offset translate.rva.ind ( translate.rva.ind ( pe-optional-header + 192 ) ) + 2 set-uint 0x454c
122
123 }