Re: [xml] Core dump with unknow charset



On Mon, May 07, 2001 at 01:13:13PM -0400, Thierry RAMA wrote:
Hi,

   I compiled libxml2-2.3.8 on AIX version 4 and release 3 with success. I 
have although WRNINGS:
ld: 0711-224 WARNING: Duplicate symbol: p_xargc
ld: 0711-224 WARNING: Duplicate symbol: p_xargv
ld: 0711-224 WARNING: Duplicate symbol: p_xrcfg
ld: 0711-224 WARNING: Duplicate symbol: p_xrc
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more 
information.

  no idea ... none of those symbols sounds familiar to me !

libxml2 crashes when used with unknown encoding like
<?xml version="1.0" encoding="ISO8859-1"?>
<CATALOG>
  <CD>
    <TITLE>Empire Burlesque</TITLE>
    <ARTIST>Bob Dylan</ARTIST>
    <COUNTRY>USA</COUNTRY>
    <COMPANY>Columbia</COMPANY>
    <PRICE>10.90</PRICE>
    <YEAR>1985</YEAR>
  </CD>
</CATALOG>

  Okay I tried to reproduce it here, doesn't work. first the iconv
library here understand "ISO8859-1" as being the ISO-8859-1 encoding.
Second if I chnage the input to use encoding="undefined"

orchis:~/XML -> ./xmllint tst.xml 
tst.xml:1: error: Unsupported encoding undefined
<?xml version="1.0" encoding="undefined"?>
                                       ^

  and it doesn't crash and exit immediately (per the spec).

doesn't make it crash. Although, encoding="ISO-8859-1" doesn't crash. But 
anithing unknown like encoding="UT-8" or encoding="sdfsdfs" makes it crash.
Here is the dbx dump of the gjobread using encoding="ISO8859-1"

Segmentation fault in iconv_open at 0xd3a5fab8
0xd3a5fab8 (iconv_open+0x8) 800c0000        lwz   r0,0x0(r12)
(dbx) where
iconv_open() at 0xd3a5fab8
xmlFindCharEncodingHandler(0x20003248), line 1626 in "encoding.c"

in this function, if the encoding is not recognized as one of the ones
that libxml handles natively, libxml uses the iconv library to provide
the support:

fdef LIBXML_ICONV_ENABLED
    /* check whether iconv can handle this */
    icv_in = iconv_open("UTF-8", name);
    icv_out = iconv_open(name, "UTF-8");
    if ((icv_in != (iconv_t) -1) && (icv_out != (iconv_t) -1)) {

  I can't tell what's happening with your iconv library at this point
but it crashes in the iconv code, not libxml one. Check with the debugger
that the encoding name passwd to iconv_open is sane (it should be
the string found in the document encoding), if this is the case, well
I'm afraid the iconv library on your system is bugged. You can try to
compile with iconv disabled as a workaround, but finding teh reason of the
error sounds a better approach.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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