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

Remove filter in avif_fuzztest_properties #2575

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

y-guyon
Copy link
Collaborator

@y-guyon y-guyon commented Jan 17, 2025

Avoid failures due to "Ineffective use of Filter()".

@y-guyon y-guyon force-pushed the remove_fuzztest_filter branch from 2a79dcc to db37f71 Compare January 17, 2025 13:03
Avoid failures due to "Ineffective use of Filter()".
@y-guyon y-guyon force-pushed the remove_fuzztest_filter branch from db37f71 to 03daa30 Compare January 17, 2025 13:15
@y-guyon y-guyon merged commit e816c7d into AOMediaCodec:main Jan 17, 2025
19 checks passed
@y-guyon y-guyon deleted the remove_fuzztest_filter branch January 17, 2025 13:28
Copy link
Collaborator

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

// Don't return known properties.
return fuzztest::Filter(
[](const TestProp& prop) {
return !avifIsKnownPropertyType(prop.fourcc.data());
Copy link
Collaborator

Choose a reason for hiding this comment

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

A random fourcc is unlikely to be a known property type. So this Filter should be okay.

}

inline auto ArbitraryUUIDProp() {
auto fourcc = fuzztest::Just(std::array<uint8_t, 4>{'u', 'u', 'i', 'd'});
auto uuid = fuzztest::Arbitrary<std::array<uint8_t, 16>>();
auto body = fuzztest::Arbitrary<std::vector<uint8_t>>();
// Don't use invalid UUIDs.
return fuzztest::Filter(
[](const TestProp& prop) { return avifIsValidUUID(prop.uuid.data()); },
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess a random 16-byte is likely to be an invalid UUID more than 90% of the time in the first 100 tries. It may make sense to replace line 87 (auto uuid = fuzztest::Arbitrary<std::array<uint8_t, 16>>();) with custom code that generates a valid UUID.

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.

3 participants