[ expat-Bugs-226514 ] cryptic err when xml PI has no encoding pseudo-attr

noreply@sourceforge.net noreply@sourceforge.net
Fri Nov 16 13:07:01 2001


Bugs item #226514, was opened at 2000-12-20 12:27
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=226514&group_id=10127

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 6
Submitted By: Vassilii Khachaturov (vassilii)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: cryptic err when xml PI has no encoding pseudo-attr

Initial Comment:
test.xml:
<?xml version="1.0"?>
<!DOCTYPE a [
<!ELEMENT a (#PCDATA|b)*>
<!ELEMENT b EMPTY>
<!ENTITY eee SYSTEM "eee.xml">
]>
<a>&eee;</a>

eee.xml:
<?xml version="1.0"?>
<b/>

Error message from Expat when parsing test.xml:
error in processing external entity reference at line 7, column 3, byte 124:
<!ENTITY eee SYSTEM "eee.xml">
]>
<a>&eee;</a>
==^

Tested with XML::Parser perl module. See http://mailarchive.activestate.com/mail/msg/perl-xml:450354

Matt Sergeant resolved my problem (pointed to the missing encoding in <?xml ...?>) and suggested I post this here, which I gladly do.


----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-11-16 13:06

Message:
Logged In: YES 
user_id=3066

Tim Crook suggested a fix for this; a variable was being
used uninitialized.  Checked in as part of lib/xmlparse.c
revision 1.25.

I *think* that fixes this bug, but I don't have a test case
to demonstrate the original bug yet.  If this comes up
again, we'll know this didn't fix it, but we've avoided a
potential segfault at any rate.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-11-12 09:24

Message:
Logged In: YES 
user_id=3066

The original report on the perl-xml list now seems to be at:
http://aspn.activestate.com/ASPN/Mail/Message/450354

Matt Sergeant's reply is now:
http://aspn.activestate.com/ASPN/Mail/Message/450541

I'm trying to construct a reproducible test case that shows
*something* goes wrong without the fix suggested by Tim
Crook, but have not been successful.  Is the error being
raised when Expat attempts to parse the referenced entity
rather than the document entity?  That seems to be the
implication, but that requires a more complex test.  (If
that's the case, I think I know what the test should be; if
anyone can confirm the nature of the symptom before I spend
a lot ot time on it, I'd appreciate it!  Thanks.)

Raised the priority so it's likely this will be fixed sooner
rather than later.

----------------------------------------------------------------------

Comment By: Tim Crook (tcrook2)
Date: 2001-11-12 07:55

Message:
Logged In: YES 
user_id=76274

This sounds like the problem with the pointer next in the 
function prologProcessor sometimes not being initialized. 
This happens when XmlPrologTok returns without initializing 
next, leading to unpredicatable results - I was 
occasionally get access violations. In expat 1.95.x, this 
problem can be fixed by assigning next a default value 
of "s", on line 2566 of xmlparse.c.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-02-16 14:21

Message:
Confirmed to still exist using the CVS version of Expat.  I'm not familiar with the Perl bindings myself, but will look further into reproducing it.

(Perhaps I should try writing a C program to do this; if it's an expat problem, we don't need the scripting bindings getting in the way.  If anyone beats me to it, speak up!)

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-02-16 10:31

Message:
I can't reproduce this using the Python Expat bindings and the CVS version of Expat; I'm not familiar with the Perl bindings.  This may be related to code driving external entity parsing as well.

Can you test this against the current CVS version of Expat?  Does the problem persist?

----------------------------------------------------------------------

Comment By: Vassilii Khachaturov (vassilii)
Date: 2001-02-06 09:35

Message:
I used precisely the script shown at 

http://mailarchive.activestate.com/mail/msg/perl-xml:450354

and these 2 XML files. 

----------------------------------------------------------------------

Comment By: Sam TH (samth)
Date: 2001-02-02 07:13

Message:
I can't reproduce any errors from those two files in current CVS.  What exactly did you do to generate the error?

----------------------------------------------------------------------

Comment By: Sam TH (samth)
Date: 2001-02-02 07:12

Message:
I can't reproduce any errors from those two files in current CVS.  What exactly did you do to generate the error?

----------------------------------------------------------------------

Comment By: Sam TH (samth)
Date: 2001-02-02 07:03

Message:
I can't reproduce any errors from those two files in current CVS.  What exactly did you do to generate the error?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=226514&group_id=10127