Re: Unfortunately, not yet solved (Was: Re: Problem solved! (Was: Re: [xml] valgrind errrors with this small sample program))

On Wed, Mar 17, 2004 at 04:29:38PM +0100, Holger Rauch wrote:
Hi Daniel!

My problem *seems* to be solved for lixml2 2.6.7
on Linux (valgrind doesn't report any errors),
but not when using Purify (a commercial memory analysis tool) on
Solaris. The Solaris I'm talking about is 2.8 running on a 64-bit system. I
used gcc 2.95.3 to compile my sample program.

It seems to me that valgrind does not detect such errors. So, probably it's
also an error on Linux; it just doesn't show up in valgrind.

From Purify I get a UMR (Unitialized memory read) error with my small sample
program (please see message

for details. My small sample program is attached there.)

The Purify log follows (unnecessary clutter ommitted;
hope it is of some use to you). Could you (or to somebody else
who is more familiar with libxml2 internals than I am) please take
yet another look on this and maybe provide a patch that fixes this (probably
minor) issue?

UMR: Uninitialized memory read:
  * This is occurring while in:
      memcmp         [rtlib.o]
      xmlParseEndTag2 [parser.c:7567]
      xmlParseElement [parser.c:7941]
      xmlParseContent [parser.c:7760]
      xmlParseElement [parser.c:7920]
      xmlParseContent [parser.c:7760]
      xmlParseElement [parser.c:7920]
      xmlParseDocument [parser.c:8511]
      xmlSAXParseMemoryWithData [parser.c:11387]
      xmlSAXParseMemory [parser.c:11419]
      xmlParseMemory [parser.c:11433]
      main           [xmlParseMemory-test-wrong-fragment.c:18]
      _start         [crt1.o]
  * Reading 15 bytes from 0xaabbe in the heap (3 bytes at 0xaabca uninit).
  * Address 0xaabbe is 214 bytes into a malloc'd block at 0xaaae8 of 1024 bytes.
  * This block was allocated from:
      malloc         [rtlib.o]
      xmlDictAddString [dict.c:103]
      xmlDictLookup  [dict.c:573]
      xmlDetectSAX2  [parser.c:605]
      xmlSAXParseMemoryWithData [parser.c:11380]
      xmlSAXParseMemory [parser.c:11419]
      xmlParseMemory [parser.c:11433]
      main           [xmlParseMemory-test-wrong-fragment.c:18]
      _start         [crt1.o]

  Can you try to change line 7567 of parser.c from
    if ((tlen > 0) && (memcmp(ctxt->input->cur, ctxt->name, tlen) == 0)) {
    if ((tlen > 0) && (memcmp(ctxt->name, ctxt->input->cur, tlen) == 0)) {

 and see if this fixes Purify report ?


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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