Skip to content

Commit

Permalink
Fixed more parser-errors found by the fuzzer; nil-receivers for AST o…
Browse files Browse the repository at this point in the history
…bjects.
  • Loading branch information
skx committed May 15, 2021
1 parent c172e6c commit 7f196d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ast/ast_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func (ce *CaseExpression) String() string {

tmp := []string{}
for _, exp := range ce.Expr {
tmp = append(tmp, exp.String())
if exp != nil {
tmp = append(tmp, exp.String())
}
}
out.WriteString(strings.Join(tmp, ","))
}
Expand Down
3 changes: 3 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,9 @@ func TestFuzzerResults(t *testing.T) {
`0.{0:{{0:{:0}}:0}}`,
`0.{0:{{0:!!{|:0}}:0}}`,
`0.-0.{�:0}`,
`0.switch(0){case�{}}`,
`0(0.switch(0){case{}}`,
`(0.switch(0){case{}}`,
}

for _, input := range inputs {
Expand Down

0 comments on commit 7f196d1

Please sign in to comment.