summaryrefslogtreecommitdiff
path: root/debian/tests/cve-2019-16395.cob
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests/cve-2019-16395.cob')
-rw-r--r--debian/tests/cve-2019-16395.cob248
1 files changed, 248 insertions, 0 deletions
diff --git a/debian/tests/cve-2019-16395.cob b/debian/tests/cve-2019-16395.cob
new file mode 100644
index 0000000..924383a
--- /dev/null
+++ b/debian/tests/cve-2019-16395.cob
@@ -0,0 +1,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+YÃmode
+ 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--formžt-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
+ .
+
+ setŽjeydefinitions 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