github-actions · GitHub

String#prepend(s, s) read RSTRING_LEN(argv[i]) in the copy loop after
mrb_str_resize had already updated the receiver's length, causing the
memcpy to write past the allocated buffer.
Detect self-references with mrb_obj_eq() and read from the memmoved
original data at p + total_prepend_len using the captured self_len.
This also handles mixed cases like s.prepend("X", s) where earlier
writes would otherwise corrupt the source of later reads.
Co-authored-by: Claude <noreply@anthropic.com>

gemini-code-assist[bot]

@matz

@matz

matz deleted the fix/string-prepend-overflow branch

April 11, 2026 07:32

matz added a commit that referenced this pull request

Apr 12, 2026
Co-authored-by: Claude <noreply@anthropic.com>

@matz matz mentioned this pull request

Apr 12, 2026

Merged

Read the original on github.com ↗