Skip to content

fix(pdf): keep function evaluation finite and interpolation stable - #1146

Merged
andiwand merged 2 commits into
mainfrom
review/128-pdf-function-numbers
Oct 6, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/128-pdf-function-numbers

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Non-finite function inputs could reach sampled-function integer conversions, while large finite intervals overflowed during interpolation. Reject non-finite inputs and final results, use stable interpolation, and validate exponential coefficients and domains. Constant results and finite range clipping remain valid when the power calculation overflows. A Separation or DeviceN colour whose tint transform fails falls back to the ink approximation, and a shading whose function fails is unusable, so a failing function never aborts the page.

Validation: the large-interval regression fails on the parent; 159 targeted tests and all 50 PDF corpus metadata/HTML-generation checks pass. LLVM 22 clang-tidy passes. The changed translation unit compiles for NDK 28.1, emsdk 3.1.73 and iOS 15, alongside the macOS 12 build.

@andiwand
andiwand force-pushed the review/127-pdf-aes-padding branch from 1a2b4f4 to ab3e889 Compare October 6, 2026 14:31
Base automatically changed from review/127-pdf-aes-padding to main October 6, 2026 14:41
andiwand and others added 2 commits October 6, 2026 16:41
Function::eval now throws on a non-finite input or result, and no caller
caught it, so one malformed function stopped the whole document. A
Separation or DeviceN colour falls back to the ink approximation it uses
without a tint transform, and a shading whose function has no finite
answer is unusable, like one with an unsupported function. The new
throw checks assign the [[nodiscard]] result to std::ignore, so the
-Werror build accepts them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
@andiwand
andiwand force-pushed the review/128-pdf-function-numbers branch from 0666414 to e7e3cea Compare October 6, 2026 14:47
@andiwand
andiwand merged commit 4de93e9 into main Oct 6, 2026
25 checks passed
@andiwand
andiwand deleted the review/128-pdf-function-numbers branch October 6, 2026 14:49
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