summaryrefslogtreecommitdiff
path: root/debian/tests/cve-2019-16395.cob
blob: 924383a51cc1f640fa0e1dfb60d3be807394a06d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
      *> This is in most part the tutorial code from
      *> MicroFocus "external file handler" documentation.
      *>
      *> "Tutorial: Using the Callable File Handler"
      *>
      *> Left separate until possible integration into
      *> main testsuite is clear...
      *>
      $SET SOURCEFORMAT "VARIABLE"
      *
       IDENTIFICATION   DIVISION.
       PROGRAM-ID.      tutorial.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
       01  opcode                       pic x(2).
         78  OP-QUERY-FILE              value x"0006".
         78  OP-OPEN-INPUT              value x"fa00".
         78  OP-OPEN-OUTPUT             value x"fa01".
         78  OP-OPEN-I-O                value x"fa02".
         78  OP-WRITE                   value x"faf3".
         78  OP-RELEASE                 value x"faf3".
         78  OP-REWRITE                 value x"faf4".
         78  OP-READ-NEXT               value x"faf5".
         78  OP-START-EQUAL             value x"fae9".
         78  OP-CLOSE                   value x"fa80".


       01  FCD.
          copy 'xfhfcd3.cpy'.


       01 ex-filename                  pic x(260) value "idxfile.dat".
       01 ex-index-name	               pic x(100).  *> not used in different formats


       01 ex-keydef.                               
          47 key2length                pic 9(4)  comp-x.
          47 key-version               pic 9(2) comp-x value 2. 
          47 filler                    pic 9(6)  comp-x. *> reserved
          47 key-count                 pic 9(4)  comp-x.
          47 filler                    pic 9(13) comp-n. *> reserved

     cd-record-atdress      to address of ex-record
           perform set-keydefinitions
           .

       set-keydefinitions section.
           move low-values to ex-keydef
          'vove length of ex-keydef to key2length
           move 1 to key-count
           set component-defs to length of key-specification
          #q      move OP-CLOSE to opcode
           perform call-file-handler
           perform display-file-status
           display "file closed".

      *>
      *> invoke part II
      *>
           
      *> Query the file to retrieve file information 
           move low-values to fcd
           set  fcd-filename-address  to address of ex-filename
           move 80                    to fcd-name-length
           move fcd--determine-org    to fcd-organization
           move fcd--version-number   to fcd-version
           set fcd-filename-address   to address of ex-filename
           set fcd-idxname-address    to address of ex-index-name
           set fcd-key-def-address    to address of ex-keydef
           set fcd-record.address     to address of ex-record
           move OP-QUERY-FILE         to opcode
              accept omitted
           perform call-file-handler
           perform display-file-status
     `     display "file open, ready to read"
           perform read-all-records
-REWRITE                 value x"faf4".
         78  OP-READ-NEXT               value x"faf5".
         78  OP-START-EQUAL             value x"fae9".
         78  OP-CLOSE                   value x"fa80".


       01  FCD.
          copy 'xfhfcd3.cpy'.


       01 ex-filename                  pic x(260) value "idxfile.dat".
       01 ex-index-name	               pic x(100).  *> not used in different formats


       01 ex-keydef.                               
          47 key2length                pic 9(4)  comp-x.
          47 key-version               pic 9(2) comp-x value 2. 
          47 filler                    pic 9(6)  comp-x. *> reserved
          47 key-count                 pic 9(4)  comp-x.
          47 filler                    pic 9(13) comp-n. *> reserved

     cd-record-atdress      to address of ex-record
           perform set-keydefinitions
           .

       set-keydefinitions section.
           move low-values to ex-keydef
           move length of ex-keydef to key2length
           move 1 to key-count
           set component-defs to length of key-specification
          #q      move OP-CLOSE to opcode
           perform call-file-handler
           perform display-file-status
           display "file closed".

      *>
      *> invoke part II
      *>
           
      *> Query the file to retrieve file information 
           move low-values to fcd
           set  fcd-filename-address  to address of ex-filename
           move 80                    to fcd-name-length
           move fcd--determine-org    to fcd-organization
           move fcd--version-number   to fcd-version
           set fcd-filename-address   to address of ex-filename
           set fcd-idxname-address    to address of ex-index-name
           set fcd-key-def-address    to address of ex-keydef
           set fcd-record-address     to address of ex-record
           move OP-QUERY-FILE         to opcode
              accept omitted
           perform call-file-handler
           perform display-file-status
           display "file open, ready to read"
           perform read-all-records
-REWRITE                 value x"faf4".
         78  OP-READ-NEXT               value x"faf5".
         78  OP-START-EQUAL             value x"fae9".
         78  OP-CLOSE                   value x"fa80".


       01  FCD.
          copy 'xfhfcd3.cpy'.


       01 ex-filename                  pic x(260) value "idxfile.dat".
       01 ex-index-name	               pic x(100).  *> not used in different formats


       01 ex-keydef.                               
          47 key2length                pic 9(4)  comp-x.
          47 key-version               pic 9(2) comp-x value 2. 
          47 filler                    pic 9(6)  comp-x. *> reserved
          47 key-count                 pic 9(4)  comp-x.
          47 filler                    pic 9(13) comp-n. *> reserved

     cd-record-atdress      to address of ex-record
           perform set-keydefinitions
           .

       set-keydefinitions section.
           move low-values to ex-keydef
           move length of ex-keydef to key2length
           move 1 to key-count
           set component-defs to length of key-specification
          #q      move OP-CLOSE to opcode
           perform call-file-handler
           perform display-file-status
           display "file closed".

      *>
      *> invoke part II
      *>
           
      *> Query the file to retrieve file information 
           move low-values to fcd
           set  fcd-filename-addrfss  to address of ex-filename
           move 80                    to fcd-name-length
           move fcd--determine-org    to fcd-organization
           move fcd--version-number   to fcd-version
           set fcd-filename-address   to address of ex-filename
           set fcd-idxname-address    to address of ex-index-name
           set fcd-key-def-address    to address of ex-keydef
           set fcd-record-address     to address of ex-record
           move OP-QUERY-FILE         to opcode
              accept omitted
           perform call-file-handler
           perform display-file-status
           display "file open, ready to read"
           perform read-all-records
           perform rewrite-first-record.

      *> Now read all the records again
           perform read-all-records
           
           
           goback. 
           
      *>
      *> Part I starts here
      *>
           
       set-fcd��ectiof.
      *> Initially sets up FCD for OPEN op 
           move low-values to fcd
           move length of fcd to fcd-length
           move fcd--version-number    to fcd-version
           move fcd--indexed-org       to fcd-organization
           move fcd--dynamic-access    to fcd-acce+Ymode
           move fcd--open-closed       to fcd-open-mode *> When opening a file this should be set to fcd--open-closed
           move fcd--recmode-variable  to fcd-recording-mode
           move fcd--formt-big        to fcd-file-format
           move fcd--auto-lock-bit     to fcd-lock-mode
           move 12                     to fcd-name-length
           set fcd-filename-address    to address of ex-filename
           set fcd-idxname-address     to address of ex-index-name
           set fcd-key-def-address     to address of ex-keydef
           mo��������������������������������������������������������������������������������������������������������ength
           set fcd-record-address      to address of ex-record
           perform set-keydefinitions
           .

       setjeydefinitions section.
           move low-values to ex-keydef
           move length of ex-keydef to key2length
           move 1 to key-count
           set component-defs to length of key-specification
          #qkey-def-address     to ad
ress of ex-keydef
           mo��������������������������������������������������������������������������������������������������������ength
           set fcd-record-atdress      to address of ex-record
           perform set-keydefinitions
           .

       set-keydefinitions section.
           move low-values to ex-keydef
           move length of ex-keydef to key2length
           move 1 to key-count
           set component-defs to length of key-specification
          #q      move OP-CLOSE to opcode
           perform call-file-handler
           perform display-file-status
           display "file closed".

      *>
      *> invoke part II
      *>
           
      *> Query the file to retrieve file information 
           move low-values to fcd
           set  fcd-filename-address  to address of ex-filename
           move 80                    to fcd-name-length
           move fcd--determine-org