Skip to content

Add defensive limits for BMFF metadata counts during parsing#3187

Open
uwezkhan wants to merge 6 commits intoAOMediaCodec:mainfrom
uwezkhan:hardening/bmff-metadata-count-limits
Open

Add defensive limits for BMFF metadata counts during parsing#3187
uwezkhan wants to merge 6 commits intoAOMediaCodec:mainfrom
uwezkhan:hardening/bmff-metadata-count-limits

Conversation

@uwezkhan
Copy link
Copy Markdown
Contributor

@uwezkhan uwezkhan commented May 2, 2026

This patch adds internal defensive limits for attacker-controlled BMFF metadata counts parsed from AVIF/HEIF files.

Several parser paths allocate memory or perform repeated processing based on counts read directly from the bitstream (items, properties, extents, groups, etc.). Malformed files can use excessive values here to trigger disproportionate memory usage and parser overhead.

To mitigate this, this change introduces conservative internal upper bounds for key metadata structures and rejects files that exceed those limits during parsing.

The limits are intentionally generous for legitimate AVIF content while preventing pathological resource-exhaustion cases from malformed inputs.

Comment thread src/read.c Outdated
Comment thread src/read.c Outdated
Comment thread include/avif/avif.h
Comment thread src/read.c Outdated
Comment thread src/read.c Outdated
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.

3 participants