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

Check that the gain map max is >= gain map min. #2580

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maryla-uc
Copy link
Collaborator

Fixes #2573

@maryla-uc maryla-uc requested a review from wantehchang January 20, 2025 16:28
@wantehchang
Copy link
Collaborator

Maryla: I am really sorry. I remember I reviewed this pull request but somehow got distracted and forgot to come back. I will review it tomorrow.

@maryla-uc
Copy link
Collaborator Author

No worries, I completely forgot about this PR as well...

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.

LGTM. Thanks!

@@ -49,12 +49,12 @@ void EncodeDecodeValid(ImagePtr image, EncoderPtr encoder, DecoderPtr decoder) {
const avifResult encoder_result =
avifEncoderWrite(encoder.get(), image.get(), &encoded_data);
ASSERT_EQ(encoder_result, AVIF_RESULT_OK)
<< avifResultToString(encoder_result);
<< avifResultToString(encoder_result) << " " << encoder->diag.error;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: change " " to ": " so that the output looks like ERROR_CODE: error message.

Also in line 57.

@@ -167,13 +168,31 @@ inline auto ArbitraryAvifAnim() {
return fuzztest::OneOf(ArbitraryAvifAnim8b(), ArbitraryAvifAnim16b());
}

// TODO: Try StructOf<Metadata>(StructOf<uint32_t[3]>())?
// Generates two signed fractions where the first one is smaller than the second
// one.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the first one is smaller than or equal to the second one, right?

[max_n, max_d](int32_t min_n) {
// For simplicity, use the same denominator for both fractions.
// This does not cover all possible fractions but makes it easy
// to gurantee that the fraction is smaller.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: gurantee => guarantee

Add "first" before "fraction".

max_n));
},
fuzztest::Arbitrary<int32_t>(),
fuzztest::InRange<uint32_t>(1, std::numeric_limits<uint32_t>::max()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional: Use fuzztest::NonZero<uint32_t>() instead?

If this change is correct, make the same change to the other instances below. Or you can make these change in a separate pull request.

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.

Require that gainMap->gainMapMax[c] be greater than or equal to gainMap->gainMapMin[c]
2 participants