From: "byroot (Jean Boussier) via ruby-core" Date: 2026-11-25T13:06:40+00:00 Subject: [ruby-core:127717] [Ruby Bug#22638] Out-of-bounds read via stale MatchData char-offset cache Issue #22638 has been reported by byroot (Jean Boussier). ---------------------------------------- Bug #22638: Out-of-bounds read via stale MatchData char-offset cache https://bugs.ruby-lang.org/issues/22638 * Author: byroot (Jean Boussier) * Status: Open * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED ---------------------------------------- ```ruby input = "abcdefgh" big = /(.)(.)(.)(.)(.)(.)(.)(.)/ small = /(.)/ big =~ input input.split(small, 2) { |s| Regexp.last_match.offset(1) if s.length == 1 } m = big.match(input) p (0..8).map { |i| m.offset(i) } ``` Expected:: ```ruby [[0, 8], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8]] ``` Actual: ```ruby [[0, 1], [0, 1], [0, 33], [15180044, 281473212212120], [0, 65], [4294967298, 281473667944640], [281473211869520, 17179869185], [4, 187651108004256], [0, 337]] ``` Reported by: ProofHunt (https://hackerone.com/proofhunt) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/