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

fix: remove usage of unsafe string in label adapter unmarshal #14216

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0
github.com/gogo/googleapis v1.4.1
github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32
github.com/grafana/loki/pkg/push v0.0.0-20231124142027-e52380921608
github.com/grafana/loki/pkg/push v0.0.0-20240923094301-8ebb2b5300f0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/hashicorp/raft v1.7.1
github.com/hashicorp/raft-wal v0.4.1
Expand Down
6 changes: 2 additions & 4 deletions pkg/push/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,6 @@ func (m *Entry) Unmarshal(dAtA []byte) error {
}

// Unmarshal a LabelAdapter, implements proto.Unmarshaller.
// NB this is a copy of the autogenerated code to unmarshal a LabelPair,
// with the byte copying replaced with a yoloString.
func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
Expand Down Expand Up @@ -632,7 +630,7 @@ func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = yoloString(dAtA[iNdEx:postIndex])
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
Expand Down Expand Up @@ -664,7 +662,7 @@ func (m *LabelAdapter) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = yoloString(dAtA[iNdEx:postIndex])
m.Value = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
Expand Down
6 changes: 2 additions & 4 deletions vendor/github.com/grafana/loki/pkg/push/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ github.com/grafana/gomemcache/memcache
# github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32
## explicit; go 1.13
github.com/grafana/jsonparser
# github.com/grafana/loki/pkg/push v0.0.0-20231124142027-e52380921608 => ./pkg/push
# github.com/grafana/loki/pkg/push v0.0.0-20240923094301-8ebb2b5300f0 => ./pkg/push
## explicit; go 1.19
github.com/grafana/loki/pkg/push
# github.com/grafana/pyroscope-go/godeltaprof v0.1.8
Expand Down
Loading