Skip to content

Commit

Permalink
Fix incorrect conversion between integer types (#2455)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptodev authored Jan 20, 2025
1 parent 4af278c commit 1136b7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/component/loki/source/file/decompresser.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (d *decompressor) readLines() {
maxLoglineSize := 2000000 // 2 MB
scanner := bufio.NewScanner(r)
scanner.Buffer(buffer, maxLoglineSize)
for line := 1; ; line++ {
for line := int64(1); ; line++ {
if !scanner.Scan() {
break
}
Expand All @@ -227,7 +227,7 @@ func (d *decompressor) readLines() {
break
}

if line <= int(d.position) {
if line <= d.position {
// skip already seen lines.
continue
}
Expand Down
8 changes: 7 additions & 1 deletion internal/component/pyroscope/java/java.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ func (j *javaComponent) updateTargets(args Arguments) {

active := make(map[int]struct{})
for _, target := range args.Targets {
pid, err := strconv.Atoi(target[labelProcessID])
pid64, err := strconv.ParseInt(target[labelProcessID], 10, 32)
if err != nil {
_ = level.Error(j.opts.Logger).Log("msg", "could not convert process ID to a 32 bit integer", "pid", target[labelProcessID], "err", err)
continue
}
pid := int(pid64)

_ = level.Debug(j.opts.Logger).Log("msg", "active target",
"target", fmt.Sprintf("%+v", target),
"pid", pid)
Expand Down

0 comments on commit 1136b7f

Please sign in to comment.