1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:30:05 -07:00

reflect: fix stack overflow panic when using haveIdenticalUnderlyingType

This commit is contained in:
Jinzhu 2021-04-20 10:43:06 +08:00
parent 163de19b47
commit 4d4217f0c1

View File

@ -1599,7 +1599,7 @@ func haveIdenticalType(T, V Type, cmpTags bool) bool {
return T == V
}
if T.Name() != V.Name() || T.Kind() != V.Kind() {
if T.Name() != V.Name() || T.Kind() != V.Kind() || T.PkgPath() != V.PkgPath() {
return false
}
@ -1679,9 +1679,6 @@ func haveIdenticalUnderlyingType(T, V *rtype, cmpTags bool) bool {
if tf.name.name() != vf.name.name() {
return false
}
if tf.typ.Kind() != Struct && tf.typ.str != vf.typ.str {
return false
}
if !haveIdenticalType(tf.typ, vf.typ, cmpTags) {
return false
}