Skip to content

fix: Harden against integer underflow in JUMBF box parsers#2200

Merged
ak-singh merged 1 commit into
contentauth:mainfrom
ak-singh:ak-singh/vuln-35262
Jun 3, 2026
Merged

fix: Harden against integer underflow in JUMBF box parsers#2200
ak-singh merged 1 commit into
contentauth:mainfrom
ak-singh:ak-singh/vuln-35262

Conversation

@ak-singh

@ak-singh ak-singh commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Vulnerability

7 functions in sdk/src/jumbf/boxes.rs compute size - HEADER_SIZE on attacker-controlled size values without first validating size >= HEADER_SIZE. A 207-byte malformed JPEG with a JUMBF box declaring
size = 4 triggers attempt to subtract with overflow during JUMBF structural parsing.

Fix

Replace size - HEADER_SIZE with size.checked_sub(HEADER_SIZE).ok_or(InvalidBoxHeader)? at each of the 7 reported sites:

  • read_json_box
  • read_cbor_box
  • read_padding_box
  • read_jp2c_box
  • read_brotli_box
  • read_embedded_content_box
  • read_super_box_impl unknown box handler

Tests

Added 7 regression tests covering all 7 fix paths.

Checklist

  • This PR represents a single feature, fix, or change.
  • All applicable changes have been documented.
  • Any TO DO items have been entered as GitHub issues and the link has been included in a comment.

@ak-singh ak-singh force-pushed the ak-singh/vuln-35262 branch 2 times, most recently from 1b6c03c to 9ebd5e9 Compare June 3, 2026 08:43
@tmathern tmathern requested a review from gpeacock June 3, 2026 17:12
@ak-singh ak-singh force-pushed the ak-singh/vuln-35262 branch from 9ebd5e9 to 04fe558 Compare June 3, 2026 19:31
@ak-singh ak-singh merged commit 9fce9a3 into contentauth:main Jun 3, 2026
26 checks passed
This was referenced Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants