Skip to content

Conversation

@wantehchang
Copy link
Collaborator

Ensure that gainmapItemCodecConfigSize is 0 if gainmapItemDataSize is 0. This matches the similar code for the alpha item.

Change a "gainmapItemDataSize > 0" to "gainmapItemDataSize != 0" for consistency. This is just a cosmetic change.

Bug: b:472695059

Ensure that gainmapItemCodecConfigSize is 0 if gainmapItemDataSize is 0.
This matches the similar code for the alpha item.

Change a "gainmapItemDataSize > 0" to "gainmapItemDataSize != 0" for
consistency. This is just a cosmetic change.

Bug: b:472695059
@wantehchang wantehchang requested a review from y-guyon January 3, 2026 01:59
}
avifCodecConfigurationBox gainmapItemCodecConfig = { 0 };
if (hasHdr && hasGainmap) {
if (hasHdr && hasGainmap && gainmapItemDataSize != 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The similar code for the alpha item is right above, at lines 4288-4298.

    avifCodecConfigurationBox alphaItemCodecConfig = { 0 };
    if (hasAlpha && alphaItemDataSize != 0) {
        if (alphaItemCodecConfigSize == 0) {
            alphaItemCodecConfigSize = mainItemCodecConfigSize;
            alphaItemCodecConfig = mainItemCodecConfig;
        } else {
            AVIF_CHECKERR(alphaItemCodecConfigSize == 4, AVIF_RESULT_BMFF_PARSE_FAILED);
            AVIF_CHECKERR(avifParseCodecConfiguration(&s, &alphaItemCodecConfig, (const char *)codecConfigType, diag),
                          AVIF_RESULT_BMFF_PARSE_FAILED); // unsigned int(8) alpha_item_codec_config[alpha_item_codec_config_size];
        }
    }

Note that the conditional expression in line 4289 has && alphaItemDataSize != 0. This is why I added && gainmapItemDataSize != 0 here.

Copy link
Contributor

@y-guyon y-guyon left a comment

Choose a reason for hiding this comment

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

Thanks!

@wantehchang wantehchang merged commit 5277b7c into AOMediaCodec:main Jan 5, 2026
21 checks passed
@wantehchang wantehchang deleted the fix-buganizer-472695059 branch January 5, 2026 21:43
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.

2 participants