xml2json
                                
                                 xml2json copied to clipboard
                                
                                    xml2json copied to clipboard
                            
                            
                            
                        abort for an invalid xml file
Hi, I found that xml2json (commit d3a3d98) crashes with the attached XML file (test.txt) (Since Github doesn't support xml file, I attached txt file instead.) which has syntax errors. The crash was observed on Ubuntu 18.04.3 with kernel 4.15.0-72-generic and x86_64. The crash can be reproduced by the following command:
Here’s the crash stack trace by GDB:
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff7483801 in __GI_abort () at abort.c:79
#2  0x00007ffff7ad8957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7adeab6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff7adeaf1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff7aded24 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x0000555555585a70 in rapidxml::xml_document
It was found by the AFL fuzzer with the xml samples in the test directory as seeds. Hope this help.
<tl attr="added attr"> 
  <nuode_without_attr/>
  <id tid="added tid">1234567890a</id>  
  <ts>
  	teplextext2 makes it more complex array
  	<text_array>text</text_array>
  	<text_array>text</text_array>
  	text3
    <lang lage="Chinese">1</lang>
    <![CDATA[hen the cdata is good.]]>
    <nnode_again_inside/>
<t>
ke it more complex
      <st>26.026</st> <du>3.993</du> <ct>жґѕжёж‘„е€¶&test</ct> 
    </t>   <t> 
  <st>48.048</st> <du>3.993</du> <ct>主演:詹姆斯.史都华</ct> 
    </t>   <t> 
  <st>60.060</st> <du>3.993</du> <ct>主演:金.诺娃</ct>  </t>  
 </ts>
</tl>
may be converted to json
{
   "tl": {
      "-attr": "added attr",
      "nuode_without_attr": {
         "-self-closing": "true"
      },
      "id": {
         "-tid": "added tid",
         "#text": "1234567890a"
      },
      "ts": {
         "#text": "\n  \tteplextext2 makes it more complex array\n  \t",
         "text_array": [
            "text",
            "text"
         ],
         "#text1": "\n  \ttext3\n    ",
         "lang": {
            "-lage": "Chinese",
            "#text": "1"
         },
         "#cdata-section": "hen the cdata is good.",
         "nnode_again_inside": {
            "-self-closing": "true"
         },
         "t": [
            {
               "#text": "\nke it more complex\n      ",
               "st": "26.026",
               "du": "3.993",
               "ct": "жґѕжёж\u2018\u201Eе€¶&test"
            },
            {
               "st": "48.048",
               "du": "3.993",
               "ct": "дё»жј\u201Dпјљи©№е§\u2020ж\u2013Ї.еЏІйѓЅеЌЋ"
            },
            {
               "st": "60.060",
               "du": "3.993",
               "ct": "дё»жј\u201Dпјљй\u2021\u2018.иЇєеЁѓ"
            }
         ]
      }
   },
   "#omit-xml-declaration": "yes"
}