xref: /PHP-7.2/ext/wddx/tests/bug73065.phpt (revision f1d7e3ca)
1--TEST--
2Bug #73065: Out-Of-Bounds Read in php_wddx_push_element of wddx.c
3--SKIPIF--
4<?php
5if (!extension_loaded('wddx')) {
6    die('skip. wddx not available');
7}
8?>
9--FILE--
10<?php
11
12$xml1 = <<<XML
13<?xml version='1.0' ?>
14    <!DOCTYPE et SYSTEM 'w'>
15    <wddxPacket ven='1.0'>
16        <array>
17            <var Name="name">
18                <boolean value="keliu"></boolean>
19            </var>
20            <var name="1111">
21                <var name="2222">
22                    <var name="3333"></var>
23                </var>
24            </var>
25        </array>
26    </wddxPacket>
27XML;
28
29$xml2 = <<<XML
30<?xml version='1.0' ?>
31    <!DOCTYPE et SYSTEM 'w'>
32    <wddxPacket ven='1.0'>
33        <array>
34            <char Name="code">
35                <boolean value="keliu"></boolean>
36            </char>
37        </array>
38    </wddxPacket>
39XML;
40
41$xml3 = <<<XML
42<?xml version='1.0' ?>
43    <!DOCTYPE et SYSTEM 'w'>
44    <wddxPacket ven='1.0'>
45        <array>
46            <boolean Name="value">
47                <boolean value="keliu"></boolean>
48            </boolean>
49        </array>
50    </wddxPacket>
51XML;
52
53$xml4 = <<<XML
54<?xml version='1.0' ?>
55    <!DOCTYPE et SYSTEM 'w'>
56    <wddxPacket ven='1.0'>
57        <array>
58            <recordset Name="fieldNames">
59                <boolean value="keliu"></boolean>
60            </recordset>
61        </array>
62    </wddxPacket>
63XML;
64
65$xml5 = <<<XML
66<?xml version='1.0' ?>
67    <!DOCTYPE et SYSTEM 'w'>
68    <wddxPacket ven='1.0'>
69        <array>
70            <field Name="name">
71                <boolean value="keliu"></boolean>
72            </field>
73        </array>
74    </wddxPacket>
75XML;
76
77for($i=1;$i<=5;$i++) {
78	$xmlvar = "xml$i";
79    $array = wddx_deserialize($$xmlvar);
80    var_dump($array);
81}
82?>
83DONE
84--EXPECTF--
85array(0) {
86}
87array(0) {
88}
89array(0) {
90}
91array(1) {
92  [0]=>
93  array(0) {
94  }
95}
96array(0) {
97}
98DONE
99