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

eskip: add comment test cases for ParsePredicates #2849

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

AlexanderYastrebov
Copy link
Member

@AlexanderYastrebov AlexanderYastrebov commented Jan 12, 2024

Add test cases from #2755 discovered by fuzzing.

@sepehrdaddev
Copy link
Member

pls also add "\x2f\x2f\x00\x00\x00\xe6\xfe\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00\xe6\xfe\x00\x00\x2f\x00\x00\x00\x00" it was another payload that also has the same behavior.

@@ -386,16 +386,22 @@ func TestPredicateParsing(t *testing.T) {
}, {
title: "star notation",
input: `*`,
}, {
title: "invalid fuzz 1",
input: `///`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, // is an eskip comment

}, {
title: "invalid fuzz 2",
input: "\x2f\x2f\x00\x00\x00\xe6\xfe\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00\xe6\xfe\x00\x00\x2f\x00\x00\x00\x00",
fail: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\x2f\x2f... == //... - a comment

Add test cases from #2755 discovered by fuzzing.

Signed-off-by: Alexander Yastrebov <[email protected]>
@AlexanderYastrebov AlexanderYastrebov changed the title eskip: ParsePredicates does not fail on invalid input eskip: add comment test cases for ParsePredicates Jan 12, 2024
@AlexanderYastrebov AlexanderYastrebov marked this pull request as ready for review January 12, 2024 15:21
@AlexanderYastrebov AlexanderYastrebov added the minor no risk changes, for example new filters label Jan 12, 2024
@sepehrdaddev
Copy link
Member

👍

1 similar comment
@szuecs
Copy link
Member

szuecs commented Jan 12, 2024

👍

@AlexanderYastrebov AlexanderYastrebov merged commit 9e57d62 into master Jan 12, 2024
14 checks passed
@AlexanderYastrebov AlexanderYastrebov deleted the eskip/invalid-does-not-fail branch January 12, 2024 15:48
@AlexanderYastrebov
Copy link
Member Author

We should also fix ParseFilters("// a comment") - currently it fails because internally parser converts it into * -> // a comment -> <shunt> which is an invalid route.

AlexanderYastrebov added a commit that referenced this pull request Jan 15, 2024
Followup on #2849

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit that referenced this pull request Jan 15, 2024
Followup on #2849

Signed-off-by: Alexander Yastrebov <[email protected]>
@sepehrdaddev
Copy link
Member

I have added comments to the fuzzer dictionary to guide the fuzzer to use it more

AlexanderYastrebov added a commit that referenced this pull request Jan 17, 2024
Followup on #2849

Signed-off-by: Alexander Yastrebov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor no risk changes, for example new filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants