[xml] libxml2 crash on entity declaration parsing



Hello,

I am still experimenting with libxml2 and entities using the SAX interface, 
and I have found that the following xml file will always make my program 
crash :

---
<?xml version="1.0"?>
<!DOCTYPE body SYSTEM "body.dtd" [
<!ENTITY xml "Extensible Markup Language">
]>
<body>
<Record>
text1
<Title id="x">
</Title>
text2 and text4
<Title id="y">
</Title>
<Title id="&xml;">
</Title>
text3
</Record>
</body>
---

If I eliminate the entity declaration, everything works fine (that is, the 
parser complains that the entiity 'xml' was not defined).

I *have* a body.dtd file, but that's not the cause of the problem : the 
problem happens also when I rename it. 

gdb reports this :

---
#0  0x8008bc54 in xmlParseEntityDecl (ctxt=0x806a8cc) at parser.c:3341
#1  0x8008e83a in xmlParseMarkupDecl (ctxt=0x806a8cc) at parser.c:4456
#2  0x80090996 in xmlParseInternalSubset (ctxt=0x806a8cc) at parser.c:5790
#3  0x800937d2 in xmlParseDocument (ctxt=0x806a8cc) at parser.c:7189
#4  0x800969ca in xmlSAXUserParseMemory (sax=0x80478d0, user_data=0x806d298,
    buffer=0x80690e6 
"body/BV_EngineID=\nbody/PosizioniPwd=\n\n\n[Logon]\nbase_URI=http://webux01:9010/cgi-bin/vru_st/vru/Start.jsp\nbody/Risultato=\nbody/Descrizione=\nbody/NumRapporti=\nbody/Rapporti=\nbody/ContoBorsa=\n\n\n[Decodifi";...,
 
size=134664856) at parser.c:9667
#5  0x804b2e7 in main (ac=7, av=0x8047cf8) at xml_main.c:757
#6  0x8049ddb in _start ()
---

The long entry at #4 does not contain the input buffer containing the XML 
file I passed to the function, but totally wrong data, probably because of 
memory corruption...

TIA

--
Fabrizio Ammollo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]