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

How do I produce an initial corpus? #88

Open
firelizzard18 opened this issue Sep 5, 2022 · 3 comments
Open

How do I produce an initial corpus? #88

firelizzard18 opened this issue Sep 5, 2022 · 3 comments

Comments

@firelizzard18
Copy link

Go's documentation's example of a fuzz test is:

example

I want to use go-fuzz-headers and I want to add seed corpus values that correspond to meaningful struct values. How do I do that?

@AdamKorcz
Copy link
Collaborator

That is a good question. I will look into that.

@finicu212
Copy link

finicu212 commented Feb 19, 2023

Hello. I also am curious about this. My use case is that I am fuzzing an API based on its OpenAPI schema, and I am transforming each schema into a Go struct. Then, I want to create some random objects of those struct types, by providing the corpus with the example OpenAPI/Swagger field.

Here is a snippet of my OpenAPI spec:

    Category:
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 1
        name:
          type: string
          example: Dogs

In this case I would like to pass 1 for the id field, and Dogs for the name field in the corpus, for the Category struct type

@AdamKorcz

@smyrman
Copy link

smyrman commented Feb 22, 2024

What about an interface like this?

Bytes(...any) []byte

Encode each passed in parameter equally to how you would decode it with a Consumer instance.

Maybe add a Producer type to allow the same configuration as a Consumer, so that Bytes on a package level is just a shorthand for fuzz.NewProducer().Bytes()

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

No branches or pull requests

4 participants