Skip to content

Commit

Permalink
Handle ingester panic with corrupt buffers (#600)
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott authored Mar 17, 2021
1 parent f7093f5 commit 59d3f97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tempodb/encoding/base/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func UnmarshalObjectFromReader(r io.Reader) (common.ID, []byte, error) {
if uint32(readLength) != protoLength {
return nil, nil, fmt.Errorf("read %d but expected %d", readLength, protoLength)
}
if int(idLength) > len(b) {
return nil, nil, fmt.Errorf("id length %d outside bounds of buffer %d. corrupt buffer?", idLength, len(b))
}

bytesID := b[:idLength]
bytesObject := b[idLength:]
Expand Down

0 comments on commit 59d3f97

Please sign in to comment.