Skip to content

Fuzz test with byte[] parameter with mutation annotation is treated as classic fuzz test / annotations are ignored #1022

@Marcono1234

Description

@Marcono1234

Version

jazzer-junit 0.28.0

Description

When a @FuzzTest takes only a single byte[] parameter but that parameter is annotated with mutation framework annotations (e.g. @WithLength), it is nonetheless treated as "classic" fuzz test and the annotations are ignored.

This can be quite irritating, especially if a user is unaware of the "classic" fuzz test mode, or when they change the signature of a mutation framework fuzz test to only have a byte[] parameter and suddenly the fuzz test turns into a "classic" one.

How to reproduce

Run this fuzz test in regression mode:

@FuzzTest
void test(byte @NotNull @WithLength(min = 1) [] b) {
    if (b.length < 1) throw new AssertionError();
}

❌ Problem: The test fails for the "<empty input>" run because the @WithLength annotation was ignored and the array is empty.

Expected behavior

If a fuzz test takes only a single byte[] parameter but that parameter is annotated (potentially nested, e.g. for arrays or parameterized types) with mutation framework annotations, then the fuzz test should be executed by the mutation framework.

Might also need some tweaks to the https://github.com/CodeIntelligenceTesting/jazzer/blob/main/docs/mutation-framework.md documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions