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

pgwire: rename ReadBuffer.GetString to GetUnsafeString #137682

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Dec 18, 2024

Previously, it was not clear that GetString would not copy data from the ReadBuffer. This could be problematic if the object was long lived, since the entire buffer would have been kept alive. To reduce risk, this patch renames GetString to GetUnsafeString. It also adds a GetSafeString method for cases where a copy is needed. The latter is adopted inside: parseClientProvidedSessionParameters

Informs: #137627
Release note: None

@fqazi fqazi requested review from a team as code owners December 18, 2024 13:23
Copy link

blathers-crl bot commented Dec 18, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, it was not clear that GetString would not copy data from the
ReadBuffer. This could be problematic if the object was long lived,
since the entire buffer would have been kept alive. To reduce risk, this
patch renames GetString to GetUnsafeString. It also adds a GetSafeString
method for cases where a copy is needed. The latter is adopted inside:
parseClientProvidedSessionParameters

Informs: cockroachdb#137627
Release note: None
@fqazi fqazi force-pushed the sessionMessageLeakCont branch from d2a22ed to 82abfd4 Compare December 18, 2024 13:47
@fqazi fqazi added backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 labels Dec 18, 2024
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nice, this is will be very helpful for avoiding similar bugs!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@rafiss rafiss added the backport-23.2.x Flags PRs that need to be backported to 23.2. label Dec 18, 2024
@fqazi
Copy link
Collaborator Author

fqazi commented Dec 18, 2024

@rafiss TFTR!

bors r+

Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

:lgtm: Nice!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@fqazi
Copy link
Collaborator Author

fqazi commented Dec 19, 2024

bors r-

@fqazi
Copy link
Collaborator Author

fqazi commented Dec 19, 2024

bors r+

Copy link

blathers-crl bot commented Dec 19, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error setting reviewers, but backport branch blathers/backport-release-23.2-137682 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/137769/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 23.2.x failed. See errors above.


error setting reviewers, but backport branch blathers/backport-release-24.1-137682 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/137770/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 24.1.x failed. See errors above.


error setting reviewers, but backport branch blathers/backport-release-24.2-137682 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/137771/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 24.2.x failed. See errors above.


error setting reviewers, but backport branch blathers/backport-release-24.3-137682 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/137772/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 24.3.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants