Skip to content

fix(pdf): return a conversion error when the PDF parser panics - #218

Open
gauravch-code wants to merge 1 commit into
firecrawl:mainfrom
gauravch-code:fix/pdf-parser-panic
Open

gauravch-code wants to merge 1 commit into
firecrawl:mainfrom
gauravch-code:fix/pdf-parser-panic

Conversation

@gauravch-code

@gauravch-code gauravch-code commented Nov 7, 2026 •

Copy link
Copy Markdown

Fixes #189.

A PDF with a missing inline-image colour-space field can trigger a panic in the PDF parser and abort the Node host process.

Catch unwinding panics at the PDF conversion boundary and return a malformed conversion error. Add regressions for the reported failure and an inline image with a valid colour space.

Validation on Windows:

  • Full Rust suite: 300 tests passed; one existing test ignored.
  • Node suite: 22 tests passed using the rebuilt native debug binding.
  • Native file and byte APIs return catchable errors, subsequent conversions succeed, and the CLI exits with code 1.
  • Workspace Clippy, Rust formatting, and whitespace checks passed.

The default panic diagnostic still appears on stderr. Browser/Wasm runtime behavior has not been verified.


Summary by cubic

Catches a PDF parser panic on inline images that miss a colour-space field, returning a malformed conversion error instead of unwinding across a native binding and aborting the Node host process.

  • The panic is caught at the conversion boundary, so no partial conversion state escapes and subsequent conversions succeed.
  • Adds regression tests for the reported failure and an inline image with a valid colour space.
  • The default panic diagnostic still appears on stderr, and browser/Wasm behavior is not verified.

Written for commit 176e7ef. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
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.

Process abort (SIGABRT) on a valid PDF containing an inline image - lopdf 0.42.0 unwrap panic

1 participant