Re: [REVIEW] Re: Fix xpath() to return namespace definitions - Mailing list pgsql-hackers

From Ali Akbar
Subject Re: [REVIEW] Re: Fix xpath() to return namespace definitions
Date
Msg-id CACQjQLr0AsSTz9m84nHXwTX2=WrYE6++C2gy-CRoz3G8D19wTg@mail.gmail.com
Whole thread Raw
In response to Re: [REVIEW] Re: Fix xpath() to return namespace definitions  (Ali Akbar <the.apaan@gmail.com>)
Responses Re: [REVIEW] Re: Fix xpath() to return namespace definitions  (Ali Akbar <the.apaan@gmail.com>)
Re: [REVIEW] Re: Fix xpath() to return namespace definitions  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Greetings,

Attached modified patch to handle xmlCopyNode returning NULL. The patch is larger because xmlerrcxt must be passed to xml_xmlnodetoxmltype (xmlerrcxt is needed for calling xml_ereport).

From libxml2 source, it turns out that the other cases that xmlCopyNode will return NULL will not happen. So in this patch i assume that the only case is memory exhaustion.

But i found some bug in libxml2's code, because we call xmlCopyNode with 1 as the second parameter, internally xmlCopyNode will call xmlStaticCopyNode recursively via xmlStaticCopyNodeList. And xmlStaticCopyNodeList doesn't check the return of xmlStaticCopyNode whether it's NULL. So if someday the recursion returns NULL (maybe because of memory exhaustion), it will SEGFAULT.

Knowing this but in libxml2 code, is this patch is still acceptable?

Thanks,
Ali Akbar
Attachment

pgsql-hackers by date:

Previous
From: Benedikt Grundmann
Date:
Subject: Is there a way to temporarily disable a index
Next
From: Etsuro Fujita
Date:
Subject: No exact/lossy block information in EXPLAIN ANALYZE for a bitmap heap scan