Re: [xml] Internal and External Validating Bug
- From: Gary Pennington <Gary Pennington uk sun com>
- To: Paolo Casarini <casarini CS UniBO IT>, xml gnome org
- Subject: Re: [xml] Internal and External Validating Bug
- Date: Tue, 20 Mar 2001 03:17:59 +0000
Hi,
This took some finding....
So, it turns out that it's to do with passing around uninitialized pointers
and the behaviour you get is compiler (and hence) platform dependant.
I could only get the core dump on Solaris x86 @(not SPARC) built with the
Forte compiler. If I built with gcc, then I didn't get the error (I'm
guessing this is because a flag in the gcc compiler is set to cause all
uninitialized pointers to be set to zero - any more informed gcc users care
to comment?)
Anyway, I managed to generate the error and the problem is in parser.c,
xmlParseNotationDecl.
The Pubid variable is not initialized explicitly and the code path taken in
your example means that it is never initialized. In other functions the
value of Pubid is compared to NULL and since it isn't NULL invalid
decisions are made and the code dumps core in an unpredictable fashion.
Patch to parser.c to fix this particular problem is attached.
I notice that there may be many uninitialized pointers lurking in this
fashion to catch the unwary. Would it be worth explicitly setting all
pointers to NULL to prevent this kind of problem for non-gcc compiler
users? I could probably find time to put together a sed script which caught
most of these...
I've also attached a patch to configure which is still broken on Solaris
when not using gcc and has been since 2.3.3
Gary
Paolo Casarini wrote:
xmllint --valid --debug test-dtd.xml says Segmentation fault with these
files:
- test-dtd.xml -
<?xml version="1.0"?>
<!DOCTYPE TEST-DTD SYSTEM "test-dtd.dtd" [
<!NOTATION type2 SYSTEM "program2">
<!ENTITY FOO2 "bar2">
]>
<TEST-DTD>&FOO1;</TEST-DTD>
- test-dtd.dtd -
<!ELEMENT TEST-DTD (#PCDATA)>
<!NOTATION type1 SYSTEM "program1">
<!ENTITY FOO1 "bar1">
It seems there's a problem when are specified external and internal dtd.
Bye
Paolo
--
Paolo Casarini - casarini cs unibo it
_______________________________________________
xml mailing list
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
*** parser.c Thu Mar 8 03:35:08 2001
--- ../../libxml2-2.3.4/parser.c Tue Mar 20 02:58:36 2001
***************
*** 2993,3001 ****
void
xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
! xmlChar *name;
! xmlChar *Pubid;
! xmlChar *Systemid;
if ((RAW == '<') && (NXT(1) == '!') &&
(NXT(2) == 'N') && (NXT(3) == 'O') &&
--- 2993,3001 ----
void
xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
! xmlChar *name=NULL;
! xmlChar *Pubid=NULL;
! xmlChar *Systemid=NULL;
if ((RAW == '<') && (NXT(1) == '!') &&
(NXT(2) == 'N') && (NXT(3) == 'O') &&
*** configure Sat Mar 10 12:33:12 2001
--- ../../libxml2-2.3.4/configure Tue Mar 20 02:58:55 2001
***************
*** 3482,3488 ****
XML_CFLAGS=""
! if test "${GCC}" != "yes" ; then
CFLAGS="${CFLAGS} -Wall "
case "${host}" in
*-*-hpux* )
--- 3482,3488 ----
XML_CFLAGS=""
! if test "${GCC}" = "yes" ; then
CFLAGS="${CFLAGS} -Wall "
case "${host}" in
*-*-hpux* )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]