fix(runtime): segmentation fault when calling interface private methods cross-package

Co-authored-by: xgopilot <noreply@goplus.org>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
luoliwoshang
2025-11-06 20:52:52 +08:00
parent d2a22252c2
commit 41b403aef7

View File

@@ -365,7 +365,7 @@ func NewItab(inter *InterfaceType, typ *Type) *Itab {
ret.fun[0] = 0
} else {
data := (*uintptr)(c.Advance(ptr, int(itabHdrSize)))
mthds := methods(u, inter.PkgPath_)
mthds := u.Methods()
for i, m := range inter.Methods {
fn := findMethod(mthds, m)
if fn == nil {
@@ -395,13 +395,6 @@ func findMethod(mthds []abi.Method, im abi.Imethod) abi.Text {
return nil
}
func methods(u *abi.UncommonType, from string) []abi.Method {
if u.PkgPath_ == from {
return u.Methods()
}
return u.ExportedMethods()
}
func IfaceType(i iface) *abi.Type {
if i.tab == nil {
return nil