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

Add Fuzz Testing for WKT parsing #366

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add Fuzz Testing for WKT parsing #366

wants to merge 1 commit into from

Conversation

peterstace
Copy link
Owner

Description

Adds Fuzz testing for WKT parsing.

This requires the experimental branch dev.fuzz of the go toolchain to run (and is protected by a build tag so that it's not compiled using the mainline go tool).

The fuzz tests start with a corpus of WKT strings collected from the sourcecode of this repo. They then mutate the corpus (using increasing code coverage as a guiding force), checking to see if the geom.UnmarshalWKT function hits an infinite loop or panics.

Check List

Have you:

  • Added unit tests? N/A

  • Add cmprefimpl tests? (if appropriate?) N/A

Related Issue

  • N/A

Benchmark Results

N/A

Copy link
Collaborator

@albertteoh albertteoh left a comment

Choose a reason for hiding this comment

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

just checking, is this PR something you'd like reviewed or is it somewhat of a draft/WIP? If the former, I'll take a closer look.

"github.com/peterstace/simplefeatures/internal/extract"
)

func FuzzParseUnmarshalWKT(f *testing.F) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is testing.F defined? I noticed there's a custom gofuzzbeta build tag here, maybe it's related somehow.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, that's right -- you need to use a custom branch of the Go toolchain to get this working (instructions here).

@peterstace
Copy link
Owner Author

just checking, is this PR something you'd like reviewed or is it somewhat of a draft/WIP? If the former, I'll take a closer look.

This is a bit of a WIP/draft (I'll change the PR to draft status to make that explicit). I was basically playing around with the upcoming Golang fuzzing feature, so see if it would be useful for simplefeatures.

My gut feel is that it's probably not terribly useful, although I think I need to come back and revisit in a bit more detail (hence I haven't closed the PR yet).

@peterstace peterstace marked this pull request as draft August 18, 2021 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants