mirror of
https://github.com/go-delve/delve.git
synced 2025-10-27 12:05:21 +08:00
proc: fix nil pointer dereference in swiss table iterator (#4015)
This is probably the reason for the panics reported by telemetry, the circumstances that cause this are unclear but we should be defensive about this anyway. Fixes #4005
This commit is contained in:
committed by
GitHub
parent
89c6cd4f34
commit
990621f98f
@ -349,6 +349,7 @@ var errSwissTableCouldNotLoad = errors.New("could not load one of the tables")
|
|||||||
var errSwissMapBadType = errors.New("swiss table type does not have some required fields")
|
var errSwissMapBadType = errors.New("swiss table type does not have some required fields")
|
||||||
var errSwissMapBadTableField = errors.New("swiss table bad table field")
|
var errSwissMapBadTableField = errors.New("swiss table bad table field")
|
||||||
var errSwissMapBadGroupTypeErr = errors.New("bad swiss map type, group type lacks some required fields")
|
var errSwissMapBadGroupTypeErr = errors.New("bad swiss map type, group type lacks some required fields")
|
||||||
|
var errSwissTableNilGroups = errors.New("bad swiss map, groups pointer is nil")
|
||||||
|
|
||||||
// loadTypes determines the correct type for it.dirPtr: the linker records
|
// loadTypes determines the correct type for it.dirPtr: the linker records
|
||||||
// this type as **table but in reality it is either *[dirLen]*table for
|
// this type as **table but in reality it is either *[dirLen]*table for
|
||||||
@ -566,6 +567,11 @@ func (it *mapIteratorSwiss) loadCurrentTable() {
|
|||||||
r.groups.RealType = r.groups.DwarfType
|
r.groups.RealType = r.groups.DwarfType
|
||||||
r.groups = r.groups.maybeDereference()
|
r.groups = r.groups.maybeDereference()
|
||||||
|
|
||||||
|
if r.groups.Addr == 0 {
|
||||||
|
it.v.Unreadable = errSwissTableNilGroups
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
it.tab = r
|
it.tab = r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user