From 51751a3a19fb97ed41d13f90fdf1e2e139a51fc2 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sun, 11 Oct 2026 11:19:42 +0900 Subject: [PATCH] Size the CGI.escapeHTML overflow test by rb_len_t The test assumed the length is narrower than size_t wherever unsigned long is, which stops holding once rb_len_t widens on mswin. It keeps running on mingw. https://bugs.ruby-lang.org/issues/22400 Co-Authored-By: Claude Opus 5.5 --- test/cgi/test_cgi_escape.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/cgi/test_cgi_escape.rb b/test/cgi/test_cgi_escape.rb index 3278bde..8c66dfa 100644 --- a/test/cgi/test_cgi_escape.rb +++ b/test/cgi/test_cgi_escape.rb @@ -183,10 +183,11 @@ def test_cgi_escape_html_nil def test_cgi_escape_html_large return if RUBY_ENGINE == 'jruby' - ulong_max, size_max = RbConfig::LIMITS.values_at("ULONG_MAX", "SIZE_MAX") - return unless ulong_max < size_max # Platforms not concerned + ulen_max = 2 ** (RbConfig::SIZEOF.fetch("rb_len_t") { RbConfig::SIZEOF["long"] } * 8) - 1 + size_max = RbConfig::LIMITS["SIZE_MAX"] + return unless ulen_max < size_max # Platforms not concerned - size = (ulong_max / 6 + 1) + size = (ulen_max / 6 + 1) begin str = '"' * size escaped = CGI.escapeHTML(str)