mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-18 18:32:30 +00:00
Fix a slice bounds out of range
panic in Go offsets calculation (#1155)
* Fix a `slice bounds out of range` error in Go offsets calculation * Change `Errorf` to `Warningf`
This commit is contained in:
parent
7a823e89f1
commit
167bbe3741
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/Masterminds/semver"
|
"github.com/Masterminds/semver"
|
||||||
"github.com/cilium/ebpf/link"
|
"github.com/cilium/ebpf/link"
|
||||||
"github.com/knightsc/gapstone"
|
"github.com/knightsc/gapstone"
|
||||||
|
"github.com/up9inc/mizu/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
type goOffsets struct {
|
type goOffsets struct {
|
||||||
@ -145,6 +146,16 @@ func getOffsets(filePath string) (offsets map[string]*goExtendedOffset, err erro
|
|||||||
symEndingIndex := symStartingIndex + sym.Size
|
symEndingIndex := symStartingIndex + sym.Size
|
||||||
|
|
||||||
// collect the bytes of the symbol
|
// collect the bytes of the symbol
|
||||||
|
textSectionDataLen := uint64(len(textSectionData) - 1)
|
||||||
|
if symEndingIndex > textSectionDataLen {
|
||||||
|
logger.Log.Warningf(
|
||||||
|
"Skipping symbol %v, ending index %v is bigger than text section data length %v",
|
||||||
|
sym.Name,
|
||||||
|
symEndingIndex,
|
||||||
|
textSectionDataLen,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
symBytes := textSectionData[symStartingIndex:symEndingIndex]
|
symBytes := textSectionData[symStartingIndex:symEndingIndex]
|
||||||
|
|
||||||
// disasemble the symbol
|
// disasemble the symbol
|
||||||
|
Loading…
Reference in New Issue
Block a user