[libxml-devel] Crash in ruby_xml_xpath_object_mark
Luc Heinrich
luc at honk-honk.com
Thu Feb 7 11:27:10 EST 2008
On 7 févr. 08, at 13:17, Luc Heinrich wrote:
> I don't know the libxml-ruby code well enough yet to propose a clean
> fix (I'm not sure that simply testing for NULL on nodesetval would be
> enough or appropriate), so if anyone could chime in... :)
After a bit of debugging, it seems that having the 'nodesetval' field
of an 'xmlXPathObject' set to NULL is perfectly normal as far as
libxml2 is concerned. If you have a look at xpath.c in the libxml2
sources, the 'xmlXPathNodeCollectAndTest' function explicitely calls
'xmlXPathCacheWrapNodeSet' with a NULL value, wich creates an
'xmlXPathObject' with a NULL 'nodesetval'. And that's exactly why the
'ruby_xml_xpath_object_mark' function crashes in my case.
So it seems that simply checking for a NULL 'nodesetval' in
'ruby_xml_xpath_object_mark' actually makes sense after all.
--
Luc Heinrich
More information about the libxml-devel
mailing list