[no subject]



Before the patch, it xmlRemoveID would never work as in the following, cur
is an xmlIDPtr (which its attr property should be compared to attr, not
itself), so this function would always return -1.

    cur = xmlHashLookup(table, ID);
    if (cur != attr) {
 xmlFree(ID);
 return(-1);
    }

The patch breaks  the regression tests due to the following:
xmlTextReaderFreeProp calls xmlRemoveID which now works and really removed
the xmlIDPtr from doc-ids.

During xmlValidateDocumentFinal, xmlValidateRef gets called from
xmlValidateCheckRefCallback.
The following block of code in xmlValidateRef fails (with the patch) for the
following reason:
id is now NULL as the ID has really been removed from the doc->ids table.
attr->parent does not exist as it was free'd a long time ago which ends up
segfaulting xmlNodeGetBase as
VECTXT passes in NULL for doc so xmlNodeGetBase uses attr->parent->doc which
we already establishes doesnt exist.

 id = xmlGetID(ctxt->doc, name);
 if (id == NULL) {
     VECTXT(ctxt, attr->parent);
     VERROR(ctxt->userData,
    "IDREF attribute %s references an unknown ID \"%s\"\n",
     attr->name, name);
     ctxt->valid = 0;
 }

Before the patch, as xmlRemoveID was not working correctly, when it is
called in xmlTextReaderFreeProp, the xmlIDPtr is not removed, so the  id =
xmlGetID(ctxt->doc, name); test from above would return a value.

I had looked at adding xmlRemoveRef right after the xmlRemoveID call in
xmlTextReaderFreeProp, when running the test however I get a lot of validity
errors.

Lastly, both xmlRemoveID and xmlRemoveRef use xmlHashUpdateEntry with a
xmlHashDeallocator passed in. This however wont decrease the table nbElems.
Is there a reason for using xmlHashUpdateEntry rather than
xmlHashRemoveEntry?

Thanks,

Rob





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