Skip to content

abort for an invalid xml file #16

@chosly

Description

@chosly

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::parse<0> () at ./include/rapidxml/rapidxml.hpp:1628
#7 xml2json[abi:cxx11](char const*) () at ./include/xml2json.hpp:248
#8 0x0000555555587e5b in convert (input=...) at xml2json.cpp:14
#9 0x00005555555568d8 in main () at xml2json.cpp:23

It was found by the AFL fuzzer with the xml samples in the test directory as seeds.
Hope this help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions