Memory problem when calling xmlBufferGrow/realloc (Re: [xml] Strange error depending on buffer size)

Date view Thread view Subject view Author view

From: Manuel Guesdon (ml@oxymium.net)
Date: Fri Feb 16 2001 - 12:15:40 EST


I've investigated deeply on the problem and it seems that realloc() call may produce a failure:

When calling xmlCharEncInFunc, I have
        buffer 8124460 : content 8126aa0, base =3D 8126aa0, cur 5, use 40, size 4000
xmlCharEncInFunc call xmlBufferGrow
which call realloc (xmlReallocLoc) with ptr=0x8126aa0 size=8100

in xmlReallocLoc p0x8126a80 before realloc() call
After it is changed to 0x811ab28 and the new ptr is 0x811ab48 (instead of ptr=0x8126aa0).

After that, I get a
"base mismatch problem
buffer 8124460 : content 811ab48, base =3D 8126aa0, cur 5, use 2020, size 8100
"
because content was changed but not base.

If I reflect content change in base and cur after this, I get no more error.

realloc() man page say "realloc(ptr) returns a pointer ... which ... may be different from ptr..."

It's the case here and it break things.

Now, I knwo the problem but I don't know enough libxml internal to provide a patch :-(

Manuel

--
______________________________________________________________________
Manuel Guesdon - OXYMIUM <mguesdon@oxymium.net>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998

---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Feb 16 2001 - 12:43:40 EST