Skip to content

Fix panic on Arazzo exponents above 1000000 - #334

Open
SebTardif wants to merge 1 commit into
pb33f:mainfrom
SebTardif:fix/arazzo-exponent-limit
Open

SebTardif wants to merge 1 commit into
pb33f:mainfrom
SebTardif:fix/arazzo-exponent-limit

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

ValidateBytes panics on an Arazzo document that contains a decimal exponent big.Rat cannot parse.

retryAfter is a number with minimum: 0. A value such as 1e1000001 passed the normalizer because the exponent was compared only with the 16MiB byte budget. math/big.Rat.SetString accepts an exponent of 1000000 and rejects 1000001. JSON Schema then nil-dereferences while comparing that number with minimum.

The normalizer now returns the existing limit error for an absolute decimal exponent above 1000000, before schema validation. An exponent of 1000000 still validates. The byte budget check is unchanged.

TestFoundationCapsBeforeCompilation covers retryAfter: 1e1000001, retryAfter: 1e-1000001, and the accepted boundary 1e1000000.

big.Rat.SetString rejects a decimal exponent above 1000000. The
normalizer only compared the exponent to the byte budget, so a value
such as retryAfter: 1e1000001 reached JSON Schema minimum checks and
nil-dereferenced. Return the existing limit error instead.

An exponent of 1000000 still validates.
@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.66%. Comparing base (a300515) to head (96b80e5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #334   +/-   ##
=======================================
  Coverage   98.66%   98.66%           
=======================================
  Files          94       94           
  Lines       12310    12310           
=======================================
  Hits        12146    12146           
  Misses        139      139           
  Partials       25       25           
Flag Coverage Δ
unittests 98.66% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant