Skip to content
Permalink
Browse files

pkg/compiler: fix infinite recursion on unions

Found by go-fuzz on fuzzbuzz.
  • Loading branch information...
dvyukov committed Mar 5, 2019
1 parent eb9e33b commit 78b7ec0fbe23a5c674401123053d6372ea3ca9c6
Showing with 5 additions and 2 deletions.
  1. +4 −1 pkg/compiler/compiler_test.go
  2. +1 −1 pkg/compiler/types.go
@@ -194,8 +194,11 @@ func TestFuzz(t *testing.T) {
"da[",
"define\x98define(define\x98define\x98define\x98define\x98define)define\tdefin",
"resource g[g]",
`t[
l t
]`,
}
consts := map[string]uint64{"A": 1, "B": 2, "C": 3, "SYS_C": 4}
consts := map[string]uint64{"A": 1, "B": 2, "C": 3, "SYS_A": 4, "SYS_B": 5, "SYS_C": 6}
eh := func(pos ast.Pos, msg string) {
t.Logf("%v: %v", pos, msg)
}
@@ -702,7 +702,7 @@ func init() {
canBeArg := true
for _, fld := range s.Fields {
desc := comp.getTypeDesc(fld.Type)
if desc == nil || desc.CanBeArgRet == nil {
if desc == nil || desc == typeStruct || desc.CanBeArgRet == nil {
return false, false
}
canBeArg1, _ := desc.CanBeArgRet(comp, fld.Type)

0 comments on commit 78b7ec0

Please sign in to comment.
You can’t perform that action at this time.