libxml2-v2.9.13: segfault somewhere in the xmlIO on x86_64
I experience a difficult-to-debug segfault apparently in the xmlIO.c when running on a QNX 6.5 Virtual Machine on a Linux host (x86_64). However, the same code runs nicely when running on a powerpc target MPC8313, same OS QNX 6.5.
The segfault happens on calling xmlParseFile() to parse the schema file. I am not attaching the xsd we use since I am for now unsure if I can disclose the file.
I have collected a core dump by the QNX dumper and tried to post-process it offline by using the QNX gdb. The only information I get from it is this:
(gdb) thread 3
[Switching to thread 3 (pid 1400891 tid 3)]#0 0xb846b680 in xmlNoNetExists (
URL=0x7fa4914 "/opt/sem6/data/instrumentmanager/instrument_profile_v1.xsd") at xmlIO.c:3906
3906 }
(gdb) bt
#0 0xb846b680 in xmlNoNetExists (URL=0x7fa4914 "/opt/sem6/data/instrumentmanager/instrument_profile_v1.xsd") at xmlIO.c:3906
Cannot access memory at address 0x4
The URL is correct and the file is present in the file system. Again, the file parsing seems to work fine when running on the target system.
I have also tried with a patched version of xmlIO.c where I have uncommented the defines for VERBOSE_FAILURE, DEBUG_EXTERNAL_ENTITIES and DEBUG_INPUT.
The only thing I get out is multiple occurences of this debug message:
I/O: read 0 chars, buffer 494
This seems to be in xmlParserInputBufferGrow(), line 3319.
When comparing the libxml2 configuration logs for both platforms, the only difference I can see is the VA_LIST_IS_ARRAY. On x86_64 (where I experience the segfault), it is 0, while on mpc8313 it is 1.
Another difference we have is the compiler optimization (-O2 on x86_64, -Os on mpc8313), but that should not be reason for the segfault.
Does anyone have an idea about what can be wrong out of this information? Are there any pre-requisites before calling xmlParseFile()? Any hints on how to get more/better debug information?
Thanks. Miguel Valero Aker Solutions ASA