unstructured
b909cf4f - Reject oversized PDF renders before bitmap allocation (#4345)

Commit
141 days ago
Reject oversized PDF renders before bitmap allocation (#4345) ## Summary - pass the configured PDF render pixel limit into `unstructured-inference` - map oversized PDF render failures to `UnprocessableEntityError` - add coverage for filename/file-object paths and render-limit error handling <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes hi-res PDF inference/rendering behavior by enforcing a per-page pixel cap and remapping upstream render failures to `UnprocessableEntityError`, which could alter error surfaces for some PDFs. Dependency bump to `unstructured-inference` may also change model/render behavior across platforms. > > **Overview** > **Prevents OOM/unsafe rendering for hi-res PDFs** by passing a new `PDF_RENDER_MAX_PIXELS_PER_PAGE` limit through to `unstructured-inference` during hi-res partitioning and PDF-to-image conversion. > > When `unstructured-inference` raises `PdfRenderTooLargeError`, the code now converts it into an `UnprocessableEntityError` so oversized pages fail fast with a consistent “unprocessable document” error instead of attempting bitmap allocation. > > Bumps the `unstructured-inference` dependency (and lockfile resolutions) and adds tests covering both filename/file-object paths and the new oversized-render error handling. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8bae7e0f2f668d406e59c527c74f272ca5bf91da. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Author
Parents
Loading