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

Add item ID 0 comment in avifCheckItemID() #2539

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add item ID 0 comment in avifCheckItemID()
[skip ci]
  • Loading branch information
y-guyon committed Jan 2, 2025
commit e1f26ebd72e94831b211cdadb13b28261a47ff95
8 changes: 8 additions & 0 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,14 @@ static void avifMetaDestroy(avifMeta * meta)

static avifResult avifCheckItemID(const char * boxFourcc, uint32_t itemID, avifDiagnostics * diag)
{
// Section 8.11.1.1 of ISO/IEC 14496-12 about MetaBox definition:
// The item_ID value of 0 should not be used
// Section 8.11.6 of ISO/IEC 14496-12 about ItemInfoEntry syntax and semantics:
// item_ID contains either 0 for the primary resource (e.g. the XML contained in an XMLBox)
// or the ID of the item for which the following information is defined.
// Assuming 'infe' is the only way to properly define an item in AVIF, a compliant item cannot have an ID of zero.
// One way to bypass that rule would be to have 'infe' with item_ID being 0, referring to "the primary resource",
// and 'pitm' defining "the primary resource" as the item with an item_ID of 0. libavif considers that as invalid.
if (itemID == 0) {
avifDiagnosticsPrintf(diag, "Box[%.4s] has an invalid item ID [%u]", boxFourcc, itemID);
return AVIF_RESULT_BMFF_PARSE_FAILED;
Expand Down