Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Can create a crash by returning an invalid fuzzer from andThen #160

Open
jwoudenberg opened this issue May 24, 2017 · 4 comments · May be fixed by #183
Open

Can create a crash by returning an invalid fuzzer from andThen #160

jwoudenberg opened this issue May 24, 2017 · 4 comments · May be fixed by #183
Assignees

Comments

@jwoudenberg
Copy link
Collaborator

This fuzzer will run into a Debug.crash:

myFuzz : Fuzzer Int
myFuzz =
    int |> andThen (\_ -> frequency [])

Error message reads:

    This test failed because it threw an exception: "Error: Ran into a `Debug.crash` in module `Fuzz.Internal` on line 63
    The message provided by the code author is:

        This shouldn't happen: Fuzz.Internal.unpackGenVal"

Looking at the code I don't think there's a ton we can do about this, but I wanted to report anyway. andThen, by its nature, ensures we only know whether a fuzzer is valid after running it which conflicts with the idea of fuzzer validness itself.

@jwoudenberg
Copy link
Collaborator Author

jwoudenberg commented May 24, 2017

Found another crashing fuzzer in this category. This one is unrelated to andThen and seems fixable.

myFuzz : Fuzzer Int
myFuzz =
    frequency
        [ ( 1, frequency [] )
        ]

@mgold
Copy link
Member

mgold commented Jul 9, 2017

Is this fixed by #183?

@jwoudenberg
Copy link
Collaborator Author

@mgold Yes!

@mgold
Copy link
Member

mgold commented Aug 14, 2018

Current behavior:

↓ Example
✗ #160

    This test failed because it threw an exception: "Error: Ran into a `Debug.crash` in module `Fuzz.Internal`
    
    This was caused by the `case` expression between lines 54 and 59.
    One of the branches ended with a crash and the following value got through:
    
        Nothing
    
    The message provided by the code author is:
    
        Returning an invalid fuzzer from `andThen` is currently unsupported"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants