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

stats, encoding: improve UUID-decoding error #136015

Merged
merged 1 commit into from
Nov 22, 2024
Merged

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Nov 22, 2024

Add a length check to DecodeUUIDValue and a more informative error wrapping to DecodeUpperBound, which will hopefully help us track down the cause of #128876.

The wrapped error message looks like:

decoding histogram version 3 type uuid value ‹666f6f›: invalid uuid length of 2

Informs: #128876

Epic: None

Release note: None

@michae2 michae2 requested review from rytaft, yuzefovich, mw5h and a team November 22, 2024 18:28
Copy link

blathers-crl bot commented Nov 22, 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

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @michae2, @mw5h, and @rytaft)


-- commits line 5 at r1:
nit: the sentence seems incomplete.


pkg/util/encoding/encoding.go line 3168 at r1 (raw file):

		return b, uuid.UUID{}, errors.Errorf("invalid uuid length of %d", len(b))
	}
	u, err = uuid.FromBytes(b[:uuidValueEncodedLength])

Nice! On a quick glance this seems like the only place in this file where we currently don't do bounds checks before slicing.

Add a length check to `DecodeUUIDValue` and a more informative error
wrapping to `DecodeUpperBound`, which will hopefully help us track down
the cause of cockroachdb#128876.

The wrapped error message looks like:

```
decoding histogram version 3 type uuid value ‹666f6f›: invalid uuid length of 2
```

Informs: cockroachdb#128876

Epic: None

Release note: None
@michae2 michae2 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 Nov 22, 2024
Copy link
Collaborator Author

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

TFYR!

bors r=yuzefovich

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @mw5h and @rytaft)


-- commits line 5 at r1:

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: the sentence seems incomplete.

oh, it was an issue number with a # symbol, lol. fixed

@michae2
Copy link
Collaborator Author

michae2 commented Nov 22, 2024

blathers backport 23.2

Copy link

blathers-crl bot commented Nov 22, 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 creating merge commit from 577f3e8 to blathers/backport-release-23.2-136015: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.2 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-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.

3 participants