Skip to content

Fix TypeAssert nil dereference bug#54

Open
bagnalla wants to merge 1 commit intoReconfigureIO:masterfrom
bagnalla:bugfix/typeassert_nil
Open

Fix TypeAssert nil dereference bug#54
bagnalla wants to merge 1 commit intoReconfigureIO:masterfrom
bagnalla:bugfix/typeassert_nil

Conversation

@bagnalla
Copy link

@bagnalla bagnalla commented Jul 6, 2020

The following is a valid Go program that will cause goblin to segfault:

package bug
func f(x interface{}) {
	switch x.(type) {}
}

It happens because a TypeAssertExpr's Type field may be nil (spec). This PR fixes the issue by replacing the use of 'DumpExprAsType' with 'AttemptExprAsType' for this field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant