u := &r.d.unit[unit]
r.b = makeBuf(r.d, u, "info", u.off, u.data)
e, err := r.Next()
- if err != nil {
+ if err != nil || e == nil || e.Tag == 0 {
return nil, err
}
ranges, err := r.d.Ranges(e)
}
}
}
+
+func TestIssue52045(t *testing.T) {
+ var abbrev, aranges, frame, line, pubnames, ranges, str []byte
+ info := []byte{0x7, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
+
+ // A hand-crafted input corresponding to a minimal-size
+ // .debug_info (header only, no DIEs) and an empty abbrev table.
+ data0, _ := New(abbrev, aranges, frame, info, line, pubnames, ranges, str)
+ reader0 := data0.Reader()
+ entry0, _ := reader0.SeekPC(0x0)
+ // main goal is to make sure we can get here without crashing
+ if entry0 != nil {
+ t.Errorf("got non-nil entry0, wanted nil")
+ }
+}