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 <noreply@anthropic.com>
This commit is contained in:
Hiroshi SHIBATAandClaude Opus 5.5 committed 2026-10-12 16:31:01 +09:00
1 parent 08a554ecfb
commit 3edde2d2a2
1 file changed
+4 -3
Notes: git 2026-10-12 07:31:49 +00:00
+4 -3
View File
@@ -157,10 +157,11 @@ class CGIEscapeTest < Test::Unit::TestCase
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)