Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

invalid grammar production 0alse #107

Open
tsatke opened this issue Jun 22, 2021 · 2 comments
Open

invalid grammar production 0alse #107

tsatke opened this issue Jun 22, 2021 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tsatke
Copy link
Contributor

tsatke commented Jun 22, 2021

SELECT 0%0alse crashes the application, but must not be parsed

@tsatke tsatke added the bug Something isn't working label Jun 22, 2021
@tsatke tsatke added this to the v0.0.1 milestone Jun 22, 2021
@tsatke tsatke assigned tsatke and SUMUKHA-PK and unassigned tsatke Jun 22, 2021
@tsatke tsatke changed the title divide by zero invalid grammar production 0alse Jun 22, 2021
@tsatke
Copy link
Contributor Author

tsatke commented Jun 22, 2021

test case:
internal/parser/issue107_test.go

func TestIssue107(t *testing.T) {
	NegativeTest{
		Name:  "issue107",
		Query: "SELECT 0%0alse",
	}.Run(t)
}

doesn't fail

@tsatke
Copy link
Contributor Author

tsatke commented Jun 22, 2021

https://github.com/xqueries/xdb/blob/master/internal/parser/simple_parser_rules.go#L974-L980

it seems like that can't be the fallback for everything, because that allows 0alse to be parsed as 0 (numeric) and then simply alse as another expression.
This is not a valid grammar production.

https://www.sqlite.org/lang_expr.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants