Skip to content
Open
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,23 @@ static avifBool avifParseItemPropertyAssociation(avifMeta * meta, const uint8_t
}
}
if (supportedType) {
if (!essential) {
// Verify that it is legal for this property to not be flagged as essential. Any
// types in this list are *required* in the spec to be flagged as essential when
// associated with an item.
static const char * essentialTypes[] = {
"av1C" // AVIF: Section 2.2.1: "This property shall be marked as essential."
Copy link

@baumanj baumanj Mar 11, 2021

Choose a reason for hiding this comment

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

Suggested change
"av1C" // AVIF: Section 2.2.1: "This property shall be marked as essential."
"av1C" // AVIF: Section 2.2.1: "This property shall be marked as essential."
"a1op" // AVIF: Section 2.3.2.1: "If associated, it shall be marked as essential."

Not sure if a1op needs to be handled differently here.

Also, should there be an opposite check for a1lx since the spec says "If associated, it shall not be marked as essential"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I'm thinking about removing lsel from the list for now and just adding boxes to this list as I add support for new boxes. lsel isn't written or read at all right now, so it seems odd to preemptively block a read on it.

};
size_t essentialTypesCount = sizeof(essentialTypes) / sizeof(essentialTypes[0]);
for (size_t i = 0; i < essentialTypesCount; ++i) {
if (!memcmp(srcProp->type, essentialTypes[i], 4)) {
// An essential-required property is not flagged as essential, bail out
return AVIF_FALSE;
}
}
}

// Supported and valid; associate it with this item.
avifProperty * dstProp = (avifProperty *)avifArrayPushPtr(&item->properties);
memcpy(dstProp, srcProp, sizeof(avifProperty));
} else {
Expand Down