GitHub Advisoryadvisory · RubyGems

GHSA-9cv2-cfxc-v4v2 Nokogiri: Null Pointer Dereference calling methods on uninitialized wrapper classes

LOW Published 2026-06-19 Modified 2026-06-19 Official page ↗
Ecosystem
RubyGems
Packages
nokogiri
Severity
Low
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U
Weaknesses
CWE-476
Reviewed
2026-06-19

Affected packages

• RubyGems nokogiri: < 1.19.4 → fixed in 1.19.4

Description

Summary Nokogiri contains a bug when calling certain methods on allocated-but-uninitialized native wrapper classes that inherit from `Nokogiri::XML::Node`. This caused a NULL pointer dereference that could crash the process. Nokogiri 1.19.4 checks for missing native data pointers and raises a `RuntimeError`. JRuby is not affected. Severity The Nokogiri maintainers have evaluated this as low severity. This is only triggered by a programming error. It requires application code to call `.allocate` directly on a native-backed class and then invoke methods on the resulting uninitialized object. It cannot be triggered by untrusted input or through normal use of the public API. Mitigation Upgrade to Nokogiri 1.19.4 or later. Avoid calling `.allocate` directly on Nokogiri native-backed classes. Use the documented constructors and factory methods instead. Credit This issue was responsibly reported by Zheng Yu from depthfirst.com.

Related

Weakness · CWE (1)

  • CWE-476 NULL Pointer Dereference weakness

References