Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsound use of String::as_mut_vec #193

Closed
mzabaluev opened this issue Jun 9, 2019 · 1 comment · Fixed by #194
Closed

Unsound use of String::as_mut_vec #193

mzabaluev opened this issue Jun 9, 2019 · 1 comment · Fixed by #194

Comments

@mzabaluev
Copy link
Contributor

As noted in a review for a proposed change, the merge implementation for strings breaks the UTF-8 invariant of a String value modified in place, in case when wire data being merged are not valid UTF-8.

@mzabaluev
Copy link
Contributor Author

mzabaluev commented Jun 9, 2019

To fix this, I need would like to understand if there is a reason why bytes::merge and string::merge do not clear the field value before extending it with the wire data. My reading of the protobuf spec suggests that the implementation should replace the value of a non-repeating field if it's seen in the same message multiple times, but bytes::merge appends to the value instead.

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 a pull request may close this issue.

1 participant