aconversions2 segfaults for some inputs in tests.aconversion.sh
I’ve traced the source of these weird errors on CI:
-:1: parser error : Extra content at the end of the document
I can reproduce it with:
$ cd bin-release
$ cat examples2/automaton/aconversion.test.2.xml ./aconversions2 -t re -a elimination
Segmentation fault
$ cat examples2/automaton/aconversion.test.5.xml ./aconversions2 -t re -a elimination
Segmentation fault
It does not segfault for aconversion.test.{1,3,4}.xml:
$ cd bin-release
$ cat examples2/automaton/aconversion.test.1.xml ./aconversions2 -t re -a elimination
<?xml version="1.0"?>
<UnboundedRegExp ref="0"><alphabet/><empty/></UnboundedRegExp>
$ cat examples2/automaton/aconversion.test.3.xml ./aconversions2 -t re -a elimination
<?xml version="1.0"?>
<UnboundedRegExp ref="0"><alphabet><Character ref="1">a</Character><Character ref="2">b</Character></alphabet><concatenation><iteration><Ref id="2"/></iteration><Ref id="1"/><iteration><Ref id="1"/></iteration><Ref id="2"/><iteration><concatenation><Ref id="2"/><iteration><Ref id="2"/></iteration><Ref id="1"/><iteration><Ref id="1"/></iteration><Ref id="2"/></concatenation></iteration><Ref id="1"/><iteration><concatenation><iteration><Ref id="1"/></iteration><Ref id="2"/><iteration><concatenation><Ref id="2"/><iteration><Ref id="2"/></iteration><Ref id="1"/><iteration><Ref id="1"/></iteration><Ref id="2"/></concatenation></iteration><Ref id="1"/></concatenation></iteration></concatenation></UnboundedRegExp>
$ cat examples2/automaton/aconversion.test.4.xml ./aconversions2 -t re -a elimination
<?xml version="1.0"?>
<UnboundedRegExp ref="0"><alphabet/><empty/></UnboundedRegExp>
It seems that the same problem happens when built with gcc or clang. I’ve tested it on gcc 6.3.0, CI provides gcc 6.2.1 and clang 3.8.1. All on Alpine Linux (musl libc), libxml2 2.9.4.