Skip to content

Commit b41ac00

Browse files
committed
first bug found via fuzzing
1 parent 789d970 commit b41ac00

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/query/expr/parser.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ func (p *Parser) parsePrefixExpression() Expression {
201201
func (p *Parser) parseCallExpression(left Expression) Expression {
202202
id, ok := left.(*Identifier)
203203
if !ok || id.quoted {
204-
p.errors = append(p.errors, fmt.Errorf("%w: %v", errInvalidFunctionName, left.String()))
204+
// ARCH: left can be nil (e.g. if expr is `(foo`), so we can't print `left.String()`
205+
// shall we have some error specific to this?
206+
p.errors = append(p.errors, fmt.Errorf("%w: %v", errInvalidFunctionName, left))
205207
return nil
206208
}
207209
funName := id.name

src/query/expr/parser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ func TestParsingErrors(t *testing.T) {
428428
{"foo in bar", errInvalidTuple},
429429
{"foo not in bar", errInvalidTuple},
430430
{"foo in ()", errInvalidTuple},
431+
{"(@(", errUnsupportedPrefixToken}, // found via fuzzing; a weird error, I know
431432
}
432433

433434
for _, test := range tests {

0 commit comments

Comments
 (0)