[xml] Core while parsing



Hello,
on Solaris we got a core
when we parse a xml document,
when the included DTD is not found.

The Xml File looks like:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE rootnode SYSTEM "dontexist.dtd">
<rootnode>
   <LogN>
      &someentitiy;
   </LogN>
</rootnode>

The included DTD doesn't exist on hdd.

I have tested it with
Libxml2 2.6.7, 2.6.14 and 2.6.16

xmllint --valid on the xml file don't crash;
Output from xmllint:
BRBA_01.xml:2: error: failed to load external entity "DMP_DOKU.dtd"
<!DOCTYPE dmp_doku_daten SYSTEM "DMP_DOKU.dtd">
                                              ^
BRBA_01.xml:3: validity error: Validation failed: no DTD found !
<dmp_doku_daten>
               ^
BRBA_01.xml:5: error: Entity 'satz_BRBA_01' not defined
      &satz_BRBA_01;
                   ^

bcheck -all executeable give the following output:

<rtc> Read from unallocated (rua):
Attempting to read 4 bytes at address 0xc in page zero
=>[1] vfprintf(0x0, 0x2b53a8, 0xffbfe77c, 0x1, 0x0, 0xffbfe730), at
0xf3587734
  [2] xmlGenericErrorDefaultFunc(ctx = (nil), msg = 0x2b53a8 "%s:%d: ",
...), line 73 in "error.c"
  [3] xmlReportError(err = 0x79a4c0, ctxt = 0x79a340, str = 0x7a00e0 "failed
to load external entity "DMP_DOKU.dtd"\n", channel = 0x22a730 =
&xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...), data = (nil)),
line 283 in "error.c"
  [4] __xmlRaiseError(schannel = (nil), channel = 0x22c460 =
&xmlParserError(void *ctx, const char *msg, ...), data = 0x79a340, ctx =
0x79a340, nod = (nil), domain = 8, code = 1549, level = XML_ERR_ERROR, file
= 0x78c900 "BRBA_01.xml", line = 2, str1 = 0x78ccc0 "DMP_DOKU.dtd", str2 =
(nil), str3 = (nil), int1 = 0, int2 = 0, msg = 0x2a311c "failed to load
external entity "%s"\n", ...), line 581 in "error.c"
  [5] __xmlLoaderErr(ctx = 0x79a340, msg = 0x2a311c "failed to load external
entity "%s"\n", filename = 0x78ccc0 "DMP_DOKU.dtd"), line 429 in "xmlIO.c"
  [6] xmlNewInputFromFile(ctxt = 0x79a340, filename = 0x78ccc0
"DMP_DOKU.dtd"), line 1466 in "parserInternals.c"
  [7] xmlDefaultExternalEntityLoader(URL = 0x78cab8 "DMP_DOKU.dtd", ID =
(nil), ctxt = 0x79a340), line 3472 in "xmlIO.c"
  [8] xmlLoadExternalEntity(URL = 0x7a22b8 "DMP_DOKU.dtd", ID = (nil), ctxt
= 0x79a340), line 3529 in "xmlIO.c"
  [9] xmlSAX2ResolveEntity(ctx = 0x79a340, publicId = (nil), systemId =
0x7a4538 "DMP_DOKU.dtd"), line 382 in "SAX2.c"
  [10] xmlSAX2ExternalSubset(ctx = 0x79a340, name = 0x7a3a6b
"dmp_doku_daten", ExternalID = (nil), SystemID = 0x7a4538 "DMP_DOKU.dtd"),
line 273 in "SAX2.c"
  [11] xmlParseDocument(ctxt = 0x79a340), line 8611 in "parser.c"
  [12] xmlDoRead(ctxt = 0x79a340, URL = (nil), encoding = (nil), options =
30, reuse = 1), line 12374 in "parser.c"
  [13] xmlCtxtReadFile(ctxt = 0x79a340, filename = 0x2e7b3c "BRBA_01.xml",
encoding = (nil), options = 30), line 12609 in "parser.c"
  [14] st_4630481_XMLConv_File_to_DOM(steuer = 0x79c360, ppDOM = 0xffbfef00,
pFilename = 0x2e7b3c "BRBA_01.xml", options = 0), line 3033 in "C4630481.c"
  [15] main(argc = 2, argv = 0xffbff02c), line 414 in "test_servicev.c"


The Function st_4630481_XMLConv_File_to_DOM works with the following params:

   <snip>

   /* create a parser context */
   pCtxt = xmlNewParserCtxt();
   if (pCtxt == NULL)
   {
      PRETURN(LOCAL_PRIO, fkt, "Failed to allocate parser context\n");
      return NOT_OK;
   }

   (ppDOM = outgoing pointer to a DOM)

   *ppDOM = xmlCtxtReadFile
      (
         pCtxt,
         pFilename,
         NULL,
         XML_PARSE_DTDVALID |
         XML_PARSE_NOENT    |
         XML_PARSE_DTDLOAD  |
         XML_PARSE_DTDATTR
      );

   if (*ppDOM == NULL)
   {
      PRETURN(LOCAL_PRIO, fkt,
         "Fehler beim Parsen des Files <%s>\n", pFilename);
      return NOT_OK;
   }

   /* saving some memory */
   pDtd = (*ppDOM) -> extSubset;
   if (pDtd != NULL)
   {
      xmlUnlinkNode ((xmlNodePtr) pDtd);
      st_4630481_DTD_Free(steuer, pDtd);
      pDtd = NULL;
   }

   xmlFreeParserCtxt(pCtxt);
   pCtxt = NULL;


How can i avoid the core, with the given options ?
If you need any further information, let me know.

Thanks in advance
Volker Roth




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