Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic if LIKE pattern is not a quoted string #931

Open
Maslino opened this issue Aug 8, 2023 · 3 comments · May be fixed by #1046
Open

Panic if LIKE pattern is not a quoted string #931

Maslino opened this issue Aug 8, 2023 · 3 comments · May be fixed by #1046
Assignees

Comments

@Maslino
Copy link

Maslino commented Aug 8, 2023

When parsing the following cesql

x LIKE 123

the cesql parser panics

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x58 pc=0x638552]

goroutine 62 [running]:
testing.tRunner.func1.2({0x680c20, 0xa16cc0})
	D:/programs/go1.17.6/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
	D:/programs/go1.17.6/src/testing/testing.go:1212 +0x218
panic({0x680c20, 0xa16cc0})
	D:/programs/go1.17.6/src/runtime/panic.go:1038 +0x215
github.com/cloudevents/sdk-go/sql/v2/parser.(*expressionVisitor).VisitLikeExpression(0xc00068f4a0, 0xc000416350)
	D:/projects/github/sdk-go/sql/v2/parser/expression_visitor.go:179 +0xf2
github.com/cloudevents/sdk-go/sql/v2/parser.(*expressionVisitor).Visit(0xc00068f4b8, {0x775820, 0xc000416350})
	D:/projects/github/sdk-go/sql/v2/parser/expression_visitor.go:75 +0x4a5
github.com/cloudevents/sdk-go/sql/v2/parser.(*expressionVisitor).VisitChildren(0x6d1120, {0x776cc0, 0xc00068f4b8})
	D:/projects/github/sdk-go/sql/v2/parser/expression_visitor.go:83 +0x57
github.com/cloudevents/sdk-go/sql/v2/parser.(*expressionVisitor).VisitCesql(0x608fe0, 0x76fcb8)
	D:/projects/github/sdk-go/sql/v2/parser/expression_visitor.go:296 +0x25
github.com/cloudevents/sdk-go/sql/v2/gen.(*CesqlContext).Accept(0xc000416328, {0x76fcb8, 0xc00068f4a0})
	D:/projects/github/sdk-go/sql/v2/gen/cesqlparser_parser.go:256 +0x87
github.com/cloudevents/sdk-go/sql/v2/parser.(*Parser).Parse(0xc0002ff980, {0xc0002ff980, 0xe})
	D:/projects/github/sdk-go/sql/v2/parser/parser.go:39 +0x2f4
github.com/cloudevents/sdk-go/sql/v2/parser.Parse(...)
	D:/projects/github/sdk-go/sql/v2/parser/parser.go:73
@embano1
Copy link
Member

embano1 commented Aug 8, 2023

Thx for flagging this! Looks like you wrote a test here, are you keen to file a PR?

@Maslino Maslino changed the title Panic if LIKE pattern is not string Panic if LIKE pattern is not a quoted string Aug 9, 2023
@Cali0707
Copy link
Contributor

Hey @duglin @embano1 could one of you assign this to me? I would be interested in fixing it

@duglin
Copy link
Contributor

duglin commented Apr 29, 2024

done - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants