Merge pull request #1387 from luoliwoshang/runtime/iface/func

fix(runtime): segmentation fault when calling interface private methods cross-package
This commit is contained in:
xushiwei
2025-11-10 13:51:42 +08:00
committed by GitHub
7 changed files with 1304 additions and 8 deletions

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