From: "rwstauner (Randy Stauner) via ruby-core" Date: 2026-09-25T02:29:19+00:00 Subject: [ruby-core:126852] [Ruby Bug#22383] Fix inverted `STR_SHARED` check in `rb_str_tmp_frozen_release` Issue #22383 has been reported by rwstauner (Randy Stauner). ---------------------------------------- Bug #22383: Fix inverted `STR_SHARED` check in `rb_str_tmp_frozen_release` https://bugs.ruby-lang.org/issues/22383 * Author: rwstauner (Randy Stauner) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: REQUIRED ---------------------------------------- https://github.com/ruby/ruby/commit/45a2c95d0f7184c9cd64ddd26699af31bea8675d#diff-430d86fdb6c4a558ab0f1b6648bbfae1720e8bde84f026e95a52740014752040R1914 mistakenly rewrote FL_TEST_RAW(orig, STR_SHARED) && !FL_TEST_RAW(orig, STR_TMPLOCK|RUBY_FL_FREEZE) as FL_TEST_RAW(orig, STR_SHARED | STR_TMPLOCK) == STR_TMPLOCK && !OBJ_FROZEN_RAW(orig) requiring orig to not be shared, the opposite of the original condition. orig always shares the buffer with tmp here, so the buffer was never given back and the string stayed shared until its next modification copied it. The next line of code then reads aux.shared from strings that are not shared, where the union holds aux.capa. -- 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/