sparklemotion / nokogiri

Nokogiri (้‹ธ) makes it easy and painless to work with XML and HTML from Ruby.
https://nokogiri.org/
MIT License
6.14k stars 896 forks source link

update to libxml2 2.11.0 or later #2865

Closed flavorjones closed 1 year ago

flavorjones commented 1 year ago

See https://discourse.gnome.org/t/libxml2-2-11-0-released/15123 for release notes.

It doesn't look like anything in here affects nokogiri security concerns, so I'm planning to include this in a 1.15.0 release, but not a 1.14.x patch release. Opinions welcome.

Lots of yak shaving to try to make this release work ...

Summary of blockers

Summary of nonblocking items

Details

flavorjones commented 1 year ago

ruby_memcheck is flagging two new leaks in this version of libxml2. I've tracked it down to schema validation of files.

Ruby reproduction:

#! /usr/bin/env ruby

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "nokogiri", path: "."
end

ASSETS_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", "test", "files"))
PO_SCHEMA_FILE = File.join(ASSETS_DIR, "po.xsd")
PO_XML_FILE = File.join(ASSETS_DIR, "po.xml")

loop do
  xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE))

  # leaks
  xsd.validate(PO_XML_FILE)

  # does not leak
  xsd.validate(Nokogiri::XML(File.read(PO_XML_FILE)))
end

C reproduction is at https://gist.github.com/flavorjones/0902cfc1467d44417979060dd3f11971

And upstream issue was opened at memory leak from `xmlSchemaValidateStream` in v2.11.x (#530) ยท Issues ยท GNOME / libxml2 ยท GitLab

flavorjones commented 1 year ago

IT IS DONE. See #2866

flavorjones commented 1 year ago

image