Bug 708373

Summary: layer/clip nesting too deep
Product: MuPDF Reporter: Jorj <jorj.x.mckie>
Component: mupdfAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: robin.watts
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   
Customer: Word Size: ---

Description Jorj 2025-03-25 13:26:11 UTC
PyMuPDF issue: https://github.com/pymupdf/PyMuPDF/issues/4403
Problem file: https://github.com/user-attachments/files/19448199/subset.pdf

Almost all viewers exhibit an extended response time.
This is the output of mutool draw:

$ mutool draw -o test.txt subset.pdf
warning: dropping unclosed PDF processor
limit error: layer/clip nesting too deep
cannot draw 'subset.pdf'

Anything that can be / should be done here?
Comment 1 Robin Watts 2025-03-26 14:47:47 UTC
Fixed with:

commit 0d48b70f9970c77d133d31a070f437cea70f067bAuthor: Robin Watts <Robin.Watts@artifex.com>
Date:   Wed Mar 26 13:08:16 2025 +0000

    Bug 708373: Record clip/layer nesting more efficiently.

    The file in question uses multiple (1000+!) nested clip regions.
    This was running us off the fixed size array. We now store a
    count of clips at each level rather than 1 per level to avoid
    this.

It is an obscenely structured file, with 1000s of nested (non rectangular) clips.
Comment 2 Jorj 2025-03-27 10:47:45 UTC
Confirming that this fix resolves the issue! See PyMuPDF post https://github.com/pymupdf/PyMuPDF/issues/4403#issuecomment-2757572934