Skip to content

crate: issue error for duplicate key in crate map#3971

Open
pmolodo wants to merge 1 commit intoPixarAnimationStudios:devfrom
pmolodo:pr/error-on-duplicate-binary-map-key
Open

crate: issue error for duplicate key in crate map#3971
pmolodo wants to merge 1 commit intoPixarAnimationStudios:devfrom
pmolodo:pr/error-on-duplicate-binary-map-key

Conversation

@pmolodo
Copy link
Copy Markdown
Contributor

@pmolodo pmolodo commented Feb 3, 2026

Description of Change(s)

crate: issue error for duplicate key in crate map

...if PXR_PREFER_SAFETY_OVER_SPEED is set

Currently, when the crate file format reads maps or variant selections, it does no checking for duplicate keys.

This came up in the AOUSD core spec working group, where it was determined that this was likely:

  • unintentional (or at least, a situation the original OpenUSD authors didn't really care about)
  • changing behavior by making it error would likely have little practical impact (besides performance implications), as we expect there are very few actual assets with this condition.

Therefore, we were wondering if OpenUSD would consider making the crate reader error when encountering such data, for clearer alignment with the spec.

Link to proposal (if applicable)

Fixes Issue(s)

Checklist

@pmolodo pmolodo changed the title crate: error on reading duplicate key in crate map crate: issue error on reading duplicate key in crate map Feb 3, 2026
...if PXR_PREFER_SAFETY_OVER_SPEED is set
@pmolodo pmolodo force-pushed the pr/error-on-duplicate-binary-map-key branch from ca4b4be to aca3681 Compare February 3, 2026 18:45
@pmolodo pmolodo changed the title crate: issue error on reading duplicate key in crate map crate: issue error for duplicate key in crate map Feb 3, 2026
@jesschimein
Copy link
Copy Markdown
Collaborator

Filed as internal issue #USD-11858

(This is an automated message. See here for more information.)

@spiffmon
Copy link
Copy Markdown
Member

spiffmon commented Feb 5, 2026

@pmolodo , in fact it's impossible to get such a "corrupt" file using the OpenUSD API's - malicious intent/hacking would be required. Given that, and that it cannot be exploited for harm (I think), is the extra check really needed?

@nvmkuruc
Copy link
Copy Markdown
Collaborator

Hi @spiffmon, I think I would more frame it as software isn't immune from bugs. It's just something that could happen while mapping the crate format to sdf. Emitting a warning seems reasonable to me, but I don't know that I would prioritize it.

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.

4 participants