Skip to content

Commit

Permalink
fix: remove usage of unsafe string in label adapter unmarshal (grafan…
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli authored and jeschkies committed Oct 1, 2024
1 parent 2bbab55 commit b008db3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
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

0 comments on commit b008db3

Please sign in to comment.