(upstream) libxml2 crashing
Closed this issue · 4 comments
flavorjones commented
Seeing crashes in the "upstream" CI, examples:
- https://github.com/sparklemotion/nokogiri/actions/runs/8302165358/job/22723875021
- https://github.com/sparklemotion/nokogiri/actions/runs/8302165358/job/22723875397
Both seem to have something to do with namespaces.
git bisecting reveals at least some crashes began with GNOME/libxml2@2840e33
flavorjones commented
Repro
#! /usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "nokogiri", path: "."
end
attr = Nokogiri::XML.parse('<foo xml:bar="http://bar.com"/>').root.attributes["bar"]
attr.namespace # boom
This looks like it has to do with xmlSearchNS
now returning a static struct if the namespace is xml
?
flavorjones commented
Yeah ok, so the static struct xmlXmlNamespace
is located in read-only memory.
$ objdump -t .libs/libxml2.so | fgrep xmlXml
000000000014f800 l O .data.rel.ro 0000000000000030 xmlXmlNamespaceStruct
000000000015a1c8 l O .data 0000000000000008 xmlXmlNamespace
which means that trying to set the _private
member is going to segfault. I will bring this up with Nick in an upstream issue.
flavorjones commented
Upstream issue is https://gitlab.gnome.org/GNOME/libxml2/-/issues/705
flavorjones commented
Nick reverted the commit upstream.