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

[csharp] ByteString.CreateCodedInput should use ArraySegment offset and count #8740

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

kiwidev
Copy link
Contributor

@kiwidev kiwidev commented Jun 16, 2021

CreateCodedInput is created from the underlying array behind the ByteString.
If this was created from a larger array (via Memory or ArrayPool etc)
then the CodedInput refers to the wrong section of memory.

Change is to add the offset and count like the other methods that use the
ArraySegment (ToString, ToBase64, WriteTo).

Fixup for #7645

…nd count

CreateCodedInput is created from the underlying array behind the ByteString.
If this was created from a larger array (via Memory<byte> or ArrayPool etc)
then the CodedInput refers to the wrong section of memory.

Change is to add the offset and count like the other methods that use the
ArraySegment (ToString, ToBase64, WriteTo).
@JamesNK
Copy link
Contributor

JamesNK commented Jun 18, 2021

@jtattermusch

Copy link
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

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

LGTM.

@jtattermusch jtattermusch merged commit 071b161 into protocolbuffers:master Jun 18, 2021
@kiwidev
Copy link
Contributor Author

kiwidev commented Jun 18, 2021

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants