Skip to content

Set string length in string_spec_RSTRING_PTR_read#1346

Merged
eregon merged 1 commit intomasterfrom
pz-set-len-before-modify-expand
Feb 8, 2026
Merged

Set string length in string_spec_RSTRING_PTR_read#1346
eregon merged 1 commit intomasterfrom
pz-set-len-before-modify-expand

Conversation

@peterzhu2118
Copy link
Member

Since we do not set the length between the call to read(fd, buffer, 30) and rb_str_modify_expand(str, 53), the length of the string is technically zero. If the call to rb_str_modify_expand actually expands the buffer, it will overwrite all the contents from the read.

Since we do not set the length between the call to `read(fd, buffer, 30)`
and `rb_str_modify_expand(str, 53)`, the length of the string is technically
zero. If the call to `rb_str_modify_expand` actually expands the buffer,
it will overwrite all the contents from the `read`.
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eregon eregon merged commit d499524 into master Feb 8, 2026
14 checks passed
@eregon eregon deleted the pz-set-len-before-modify-expand branch February 8, 2026 11:38
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.

2 participants