Skip to content

fix code unit/code point mix-up in cord substring length#2040

Open
sahvx655-wq wants to merge 1 commit into
google:masterfrom
sahvx655-wq:cord-substring-units
Open

fix code unit/code point mix-up in cord substring length#2040
sahvx655-wq wants to merge 1 commit into
google:masterfrom
sahvx655-wq:cord-substring-units

Conversation

@sahvx655-wq
Copy link
Copy Markdown

The cord overload of SubstringImpl in common/values/string_value.cc:745 passes size_code_points - start_code_units as the byte length to Subcord, mixing a code-point count with a byte offset. Use size_code_units so large strings backed by a cord return the correct bytes instead of a truncated or over-long range on multi-byte input.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Jun 2, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jnthntatum
Copy link
Copy Markdown
Collaborator

Thanks for the contribution. Please sign the CLA and add a regression test and we can take a look.

@sahvx655-wq
Copy link
Copy Markdown
Author

Thanks for the contribution. Please sign the CLA and add a regression test and we can take a look.

Done

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