Skip to content

Avoid overlapping copies in StringIO#ungetc - #245

Closed
imattas wants to merge 1 commit into
ruby:masterfrom
imattas:stringio-ungetc-overlap-safe
Closed

imattas wants to merge 1 commit into
ruby:masterfrom
imattas:stringio-ungetc-overlap-safe

Conversation

@imattas

@imattas imattas commented Nov 26, 2026

Copy link
Copy Markdown

Summary

  • Use memmove for the final StringIO#ungetc byte copy so self-aliasing input is handled safely when the destination overlaps the source.
  • Add regressions for a cursor beyond the backing string and for a large self-aliasing string that grows during the operation.

Testing

  • Focused StringIO#ungetc tests with an ASan-enabled Ruby build: 3 tests, 6 assertions, 0 failures, 0 errors.

@imattas imattas closed this by deleting the head repository Nov 28, 2026

This branch was previously deployed

1 inactive deployment
release — 7bb7720a Deployed Nov 26, 2026 by imattas via RubyGems (ruby) #312
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant