Skip to content

Commit

Permalink
Ticket #323 XML parser crashes, test extended to verify bug report,
Browse files Browse the repository at this point in the history
Fix tbd.

git-svn-id: https://svn.code.sf.net/p/tcnopen/trdp/trunk@2158 3b5a3598-5f4e-4449-9e63-bd40438bfec0
  • Loading branch information
bloehr committed Mar 27, 2020
1 parent 2114113 commit f9747aa
Show file tree
Hide file tree
Showing 1,864 changed files with 68,069 additions and 1 deletion.
79 changes: 79 additions & 0 deletions trdp/test/xml/afl/afl-in/device1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trdp-config.xsd" host-name="device1" leader-name="device1" type="dummy">
<device-configuration memory-size="65535">
<mem-block-list>
<mem-block size="72" preallocate="256"/>
</mem-block-list>
</device-configuration>

<bus-interface-list>
<bus-interface network-id="1" name="eth0" host-ip="10.0.1.100">
<trdp-process blocking="no" cycle-time="1000" priority="80" traffic-shaping="on" />
<pd-com-parameter marshall="on" port="17224" qos="5" ttl="64" timeout-value="100000" validity-behavior="keep" />
<md-com-parameter udp-port="17225" tcp-port="17225"
confirm-timeout="1000000" connect-timeout="60000000" reply-timeout="5000000"
marshall="off" protocol="UDP" qos="3" retries="2" ttl="64" />
<telegram name="tlg1001" com-id="1001" data-set-id="1001" com-parameter-id="1">
<pd-parameter cycle="5000" marshall="on" timeout ="1000000" validity-behavior="keep"/>
<source id="1" uri1="10.0.1.101">
<sdt-parameter smi1="1234" udv="56" rx-period="500" tx-period="2000" />
</source>
<destination id="1" uri="10.0.1.101">
<sdt-parameter smi1="1234" udv="56" rx-period="500" tx-period="2000" />
</destination>
</telegram>
</bus-interface>
</bus-interface-list>

<mapped-device-list>
</mapped-device-list>

<com-parameter-list>
<!--Default PD communication parameters-->
<com-parameter id="1" qos="5" ttl="64" />
<!--Default MD communication parameters-->
<com-parameter id="2" qos="3" ttl="64" />
<!--Own PD communication parameters-->
<com-parameter id="4" qos="4" ttl="2" />
</com-parameter-list>

<data-set-list>
<data-set name="testDS1001" id="1001">
<element name="u8_A" type="8"/>
<element name="u8_B" type="8"/>
<element name="u16" type="9"/>
<element name="u32" type="10"/>
<element name="u64" type="11"/>
</data-set>
<data-set name="testDS1002" id="1002">
<element name="au8" type="8" array-size="16"/>
<element name="au16" type="9" array-size="16"/>
<element name="au32" type="10" array-size="16"/>
<element name="au64" type="11" array-size="16"/>
</data-set>
<data-set name="testDS1003" id="1003">
<element name="td32" type="14"/>
<element name="au8" type="8" array-size="4"/>
<element name="td64" type="16"/>
</data-set>
<data-set name="testDS1004" id="1004">
<element name="td64" type="16"/>
<element name="r64" type="13"/>
<element name="u64" type="11"/>
<element name="i64" type="7"/>
<element name="td32" type="14"/>
<element name="r32" type="12"/>
<element name="u32" type="10"/>
<element name="i32" type="6"/>
<element name="u16" type="9"/>
<element name="i16" type="5"/>
<element name="utf16" type="3"/>
<element name="u8" type="8"/>
<element name="i8" type="4"/>
<element name="c" type="2"/>
<element name="b" type="1"/>
</data-set>
</data-set-list>

<debug file-name="trdp.log" file-size="1000000" level="E" />
</device>
75 changes: 75 additions & 0 deletions trdp/test/xml/afl/afl-in/device2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trdp-config.xsd" host-name="device2" leader-name="device2" type="dummy">
<device-configuration memory-size="65535">
<mem-block-list>
<mem-block size="72" preallocate="256"/>
</mem-block-list>
</device-configuration>

<bus-interface-list>
<bus-interface network-id="1" name="en5" host-ip="10.0.1.101">
<trdp-process blocking="no" cycle-time="1000" priority="80" traffic-shaping="on" />
<pd-com-parameter marshall="off" port="17224" qos="5" ttl="64" timeout-value="100000" validity-behavior="keep" />
<md-com-parameter udp-port="17225" tcp-port="17225"
confirm-timeout="1000000" connect-timeout="60000000" reply-timeout="5000000"
marshall="off" protocol="UDP" qos="3" retries="2" ttl="64" />
<telegram name="tlg1001" com-id="1001" data-set-id="1001" com-parameter-id="1">
<pd-parameter cycle="5000" marshall="off" timeout ="1000000" validity-behavior="keep"/>
<source id="1" uri1="10.0.1.100"/>
<destination id="1" uri="10.0.1.100"/>
</telegram>
</bus-interface>
</bus-interface-list>

<mapped-device-list>
</mapped-device-list>

<com-parameter-list>
<!--Default PD communication parameters-->
<com-parameter id="1" qos="5" ttl="64" />
<!--Default MD communication parameters-->
<com-parameter id="2" qos="3" ttl="64" />
<!--Own PD communication parameters-->
<com-parameter id="4" qos="4" ttl="2" />
</com-parameter-list>

<data-set-list>
<data-set name="testDS1001" id="1001">
<element name="u8_A" type="8"/>
<element name="u8_B" type="8"/>
<element name="u16" type="9"/>
<element name="u32" type="10"/>
<element name="u64" type="11"/>
</data-set>
<data-set name="testDS1002" id="1002">
<element name="au8" type="8" array-size="16"/>
<element name="au16" type="9" array-size="16"/>
<element name="au32" type="10" array-size="16"/>
<element name="au64" type="11" array-size="16"/>
</data-set>
<data-set name="testDS1003" id="1003">
<element name="td32" type="14"/>
<element name="au8" type="8" array-size="4"/>
<element name="td64" type="16"/>
</data-set>
<data-set name="testDS1004" id="1004">
<element name="td64" type="16"/>
<element name="r64" type="13"/>
<element name="u64" type="11"/>
<element name="i64" type="7"/>
<element name="td32" type="14"/>
<element name="r32" type="12"/>
<element name="u32" type="10"/>
<element name="i32" type="6"/>
<element name="u16" type="9"/>
<element name="i16" type="5"/>
<element name="utf16" type="3"/>
<element name="u8" type="8"/>
<element name="i8" type="4"/>
<element name="c" type="28"/>
<element name="b" type="1"/>
</data-set>
</data-set-list>

<debug file-name="trdp.log" file-size="1000000" level="E" />
</device>
101 changes: 101 additions & 0 deletions trdp/test/xml/afl/afl-in/example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trdp-config.xsd" host-name="examplehost" leader-name="leaderhost" type="dummy">
<device-configuration memory-size="65535">
<mem-block-list>
<mem-block size="32" preallocate="512" />
<mem-block size="72" preallocate="256"/>
<mem-block size="128" preallocate="256"/>
</mem-block-list>
</device-configuration>

<bus-interface-list>
<bus-interface network-id="1" name="eth0" >
<trdp-process blocking="no" cycle-time="10000" priority="80" traffic-shaping="on" />
<pd-com-parameter marshall="on" port="17224" qos="5" ttl="64" timeout-value="100000" validity-behavior="zero" />
<md-com-parameter udp-port="17225" tcp-port="17225"
confirm-timeout="1000000" connect-timeout="60000000" reply-timeout="5000000"
marshall="off" protocol="UDP" qos="3" retries="2" ttl="64" />
<telegram name="tlg1001" com-id="1001" data-set-id="1001" com-parameter-id="1">
<pd-parameter cycle="10000" marshall="on" timeout ="30000" validity-behavior="keep"/>
<source id="1" uri1="10.2.13.50">
<sdt-parameter smi1="1234" udv="56" rx-period="500" tx-period="2000" />
</source>
<destination id="1" uri="239.2.13.0">
<sdt-parameter smi1="1234" udv="56" rx-period="500" tx-period="2000" />
</destination>
</telegram>
<telegram name="tlg1002" com-id="1002" data-set-id="1002" com-parameter-id="4">
<pd-parameter cycle="50000" marshall="on" timeout ="150000" validity-behavior="zero"/>
<source id="1" uri1="10.2.13.50" />
<destination id="1" uri="10.2.13.50" />
<destination id="2" uri="10.2.13.60" />
</telegram>
</bus-interface>
<bus-interface network-id="2" name="eth1" >
<trdp-process blocking="no" cycle-time="50000" priority="20" traffic-shaping="on" />
<pd-com-parameter marshall="off" port="21548" qos="4" ttl="64" timeout-value="500000" validity-behavior="keep" callback="on" />
<md-com-parameter udp-port="21550" tcp-port="21550"
confirm-timeout="1500000" connect-timeout="65000000" reply-timeout="5500000"
marshall="off" protocol="TCP" qos="1" retries="4" ttl="64" callback="on" />
<telegram name="tlg1004" com-id="1004" data-set-id="1004" com-parameter-id="1">
<source id="5" uri1="192.168.13.50" />
<destination id="5" uri="192.168.13.50" />
</telegram>
</bus-interface>
</bus-interface-list>

<mapped-device-list>
</mapped-device-list>

<com-parameter-list>
<!--Default PD communication parameters-->
<com-parameter id="1" qos="5" ttl="64" />
<!--Default MD communication parameters-->
<com-parameter id="2" qos="3" ttl="64" />
<!--Own PD communication parameters-->
<com-parameter id="4" qos="4" ttl="2" />
</com-parameter-list>

<data-set-list>
<data-set name="testDS1001" id="1001">
<element name="u8_A" type="UINT8"/>
<element name="u8_B" type="UINT8"/>
<element name="u16" type="UINT16"/>
<element name="u32" type="UINT32"/>
<element name="u64" type="UINT64"/>
</data-set>
<data-set name="testDS1002" id="1002">
<element name="au8" type="UINT8" array-size="16"/>
<element name="au16" type="UINT16" array-size="16"/>
<element name="au32" type="UINT32" array-size="16"/>
<element name="au64" type="UINT64" array-size="16"/>
</data-set>
<data-set name="testDS1003" id="1003">
<element name="td32" type="TIMEDATE32"/>
<element name="au8" type="UINT8" array-size="4"/>
<element name="td64" type="TIMEDATE64"/>
</data-set>
<data-set name="testDS1004" id="1004">
<element name="td64" type="TIMEDATE64"/>
<element name="r64" type="REAL64"/>
<element name="u64" type="UINT64"/>
<element name="i64" type="INT64"/>
<element name="td32" type="TIMEDATE32"/>
<element name="r32" type="REAL32"/>
<element name="u32" type="UINT32"/>
<element name="i32" type="INT32"/>
<element name="u16" type="UINT16"/>
<element name="i16" type="INT16"/>
<element name="utf16" type="UTF16"/>
<element name="u8" type="UINT8"/>
<element name="i8" type="INT8"/>
<element name="c" type="CHAR8"/>
<element name="b" type="BOOL8"/>
</data-set>
<data-set name="testDS1005" id="1005">
<element name="aDS1001" type="1001" array-size ="32"/>
</data-set>
</data-set-list>

<debug file-name="trdp.log" file-size="1000000" level="W" />
</device>
52 changes: 52 additions & 0 deletions trdp/test/xml/afl/afl-in/nestedDS.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trdp-config.xsd" host-name="examplehost" leader-name="leaderhost" type="dummy">
<device-configuration memory-size="65535">
<mem-block-list>
</mem-block-list>
</device-configuration>

<bus-interface-list>
<bus-interface network-id="1" name="en0" >
<trdp-process blocking="no" cycle-time="10000" priority="80" traffic-shaping="on" />
<pd-com-parameter marshall="on" port="17224" qos="5" ttl="64" timeout-value="100000" validity-behavior="zero" />
<md-com-parameter udp-port="17225" tcp-port="17225"
confirm-timeout="1000000" connect-timeout="60000000" reply-timeout="5000000"
marshall="off" protocol="UDP" qos="3" retries="2" ttl="64" />
<telegram name="tlg1001" com-id="1001" data-set-id="2004" com-parameter-id="1">
<pd-parameter cycle="100000" marshall="on" timeout ="300000" validity-behavior="keep"/>
<destination id="1" uri="239.0.1.1">
</destination>
</telegram>
</bus-interface>
</bus-interface-list>

<mapped-device-list>
</mapped-device-list>

<com-parameter-list>
<!--Default PD communication parameters-->
<com-parameter id="1" qos="5" ttl="64" />
<!--Default MD communication parameters-->
<com-parameter id="2" qos="3" ttl="64" />
</com-parameter-list>

<data-set-list>
<data-set name="DS2" id="2002">
<element name="c8-1" type="CHAR8"/>
<element name="i32-1" type="INT32"/>
<element name="i32-2" type="INT32"/>
</data-set>
<data-set name="DS3" id="2003">
<element name="u32-1" type="UINT32"/>
<element name="i32-1" type="INT32"/>
<!--element name="DS2" type="2002"/-->
</data-set>
<data-set name="DS4" id="2004">
<element name="1" type="TIMEDATE32" array-size="3"/>
<element name="2" type="TIMEDATE48" array-size="3"/>
<element name="3" type="TIMEDATE64" array-size="3"/>
</data-set>
</data-set-list>

<debug file-name="trdp.log" file-size="1000000" info="DTFC" level="W" />
</device>
Loading

0 comments on commit f9747aa

Please sign in to comment.