Re: [REVIEW] Re: Fix xpath() to return namespace definitions
От | Ali Akbar |
---|---|
Тема | Re: [REVIEW] Re: Fix xpath() to return namespace definitions |
Дата | |
Msg-id | CACQjQLqykR2M832uLFO1FnhrXpSzEvJ7f1JLrnXJJ_-Uw25dFQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [REVIEW] Re: Fix xpath() to return namespace definitions (Ali Akbar <the.apaan@gmail.com>) |
Список | pgsql-hackers |
Greetings,
Because of the memory bug in xmlCopyNode, this is a new patch with different method. In this patch, instead of using xmlCopyNode to bring the namespace back, we added the required namespaces to the node before dumping the node to string, and cleaning it up afterwards (because the same node could be dumped again in next xpath result).
Thanks,
Ali Akbar
2014-07-11 15:36 GMT+07:00 Ali Akbar <the.apaan@gmail.com>:
Thanks,Knowing this but in libxml2 code, is this patch is still acceptable?Greetings,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.
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).
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.
Ali Akbar
Ali Akbar
Вложения
В списке pgsql-hackers по дате отправления: