Bug 708541

Summary: Error in pdf_rearrange_pages()
Product: MuPDF Reporter: Jorj <jorj.x.mckie>
Component: mupdfAssignee: MuPDF bugs <mupdf-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: robin.watts
Priority: P2    
Version: 1.26.0   
Hardware: All   
OS: All   
Customer: Word Size: ---

Description Jorj 2025-05-13 16:27:26 UTC
The function seems to always throw the exception "Cycle detected in outlines" for any PDF that has a table of contents.
Among failing PDFs also is the Adobe PDF specification 2008.

In PyMuPDF, we can only work with the variant pdf_rearrange_page2(doc, list, 0)
which interfaces with the original.
Comment 1 Robin Watts 2025-05-14 11:49:15 UTC
Fixed with:

commit f84bb9fbe8abea011d500d28d90e3c31c576a209
Author: Robin Watts <Robin.Watts@artifex.com>
Date:   Tue May 13 19:47:55 2025 +0100

    Bug 708541: Fix cycle detection in pdf_rearrange_pages.

    We were marking/checking an object for cycles in strip_outline,
    but we immediately call strip_outlines with it, which checks
    itself!

    Only check in strip_outlines.
Comment 2 Jorj 2025-05-14 12:11:50 UTC
Thanks for such a fast fix!