[xml] xmllint --shell dumps core



Input file:

<personen>
  <person name="foo">
       <street>...</street>
  </person>
  <person name="bar">
       <street>...</street>
  </person>
</personen>



$ xmllint --shell

/ > cd /personen
/personen is a 0 Node Set
/ > cd /personen/person

Program received signal SIGSEGV, Segmentation fault.
0x4006c493 in xmlShell (doc=0x806cab8, filename=0xbffff9a2 "table.xml",
input=0x8049e10 <xmlShellReadline>, output=0x402095e0) at debugXML.c:2113
2113                                if (list->nodesetval->nodeNr == 1) {
(gdb) p list
$1 = 0x805d410
(gdb) p *list
$2 = {type = XPATH_NODESET, nodesetval = 0x0, boolval = 0, floatval = 0,
  stringval = 0x0, user = 0x0, index = 0, user2 = 0x0, index2 = 0}
(gdb) bt
#0  0x4006c493 in xmlShell (doc=0x806cab8, filename=0xbffff9a2 "table.xml",
input=0x8049e10 <xmlShellReadline>, output=0x402095e0) at debugXML.c:2113
#1  0x804a52d in parseAndPrintFile (filename=0xbffff9a2 "table.xml")
    at xmllint.c:624
#2  0x804b81b in main (argc=3, argv=0xbffff7ec) at xmllint.c:1072
#3  0x40110c6f in __libc_start_main () from /lib/libc.so.6
(gdb) q


Same happens for

cd /personen/person[ name="bar"]


The attached diff (against 2.4.8) prevents the core dump, but is
certainly not the correct solution.

 Heiko


--
Heiko W. Rupp
Project Management
WiredMinds Informationssysteme GmbH
Wilhelmsplatz 11
D-70182 Stuttgart

Email: Heiko Rupp WiredMinds de            Phone: +49 711 49048-232
Mobile: +49 172 7471 438                   Fax:   +49 711 49048-111
*** debugXML.c,1        Wed Nov  7 12:10:24 2001
--- debugXML.c  Wed Nov  7 12:24:55 2001
***************
*** 2110,2122 ****
                                              "%s: no such node\n", arg);
                              break;
                          case XPATH_NODESET:
!                             if (list->nodesetval->nodeNr == 1) {
                                  ctxt->node = list->nodesetval->nodeTab[0];
                              } else
!                                 xmlGenericError(xmlGenericErrorContext,
                                                  "%s is a %d Node Set\n",
                                                  arg,
                                                  list->nodesetval->nodeNr);
                              break;
                          case XPATH_BOOLEAN:
                              xmlGenericError(xmlGenericErrorContext,
--- 2110,2127 ----
                                              "%s: no such node\n", arg);
                              break;
                          case XPATH_NODESET:
!                             if ((list->nodesetval) && 
!                                (list->nodesetval->nodeNr == 1)) {
                                  ctxt->node = list->nodesetval->nodeTab[0];
                              } else
!                               if (list->nodesetval)
!                                       xmlGenericError(xmlGenericErrorContext,
                                                  "%s is a %d Node Set\n",
                                                  arg,
                                                  list->nodesetval->nodeNr);
+                               else
+                                        xmlGenericError(xmlGenericErrorContext,
+                                               "list->nodesetval is empty\n");
                              break;
                          case XPATH_BOOLEAN:
                              xmlGenericError(xmlGenericErrorContext,


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