https://bugs.documentfoundation.org/show_bug.cgi?id=171639

            Bug ID: 171639
           Summary: Writer hangs indefinitely during PDF export when page
                    size is reduced but margins exceed page dimensions
           Product: LibreOffice
           Version: 26.2.1.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 206545
  --> https://bugs.documentfoundation.org/attachment.cgi?id=206545&action=edit
C++ Sample application

Description:
The LibreOffice UNO API hangs during PDF export when a document’s page size is
reduced without adjusting the margins, resulting in invalid page geometry where
the text body width and/or height becomes zero or negative.

This behavior occurs via the UNO API ("XStorable::storeToURL()" with the
"writer_pdf_Export" filter).

In such cases:
   Writer does not report an error.
   The export never completes.
   The application becomes unresponsive and must be terminated manually.

The issue appears to be caused by Writer allowing page styles where:
    PageWidth  < LeftMargin + RightMargin
    PageHeight < TopMargin  + BottomMargin

When this occurs, pagination/layout does not converge, and PDF export blocks
indefinitely while waiting for layout completion.


Steps to Reproduce:
1.  Load a DOCX file via UNO ("XComponentLoader").
2.  Modify "PageStyle.Width" and "PageStyle.Height" only.
3.  Leave the existing large margin values unchanged.
4.  Call "XStorable::storeToURL()" with the "writer_pdf_Export" filter.

Sample C++ code and a test input document are attached to the ticket.
usage : <EXE Name> --input "testFile4.docx"   --output  "testFile4.pdf" --width
 280 --height 203


Actual Results:
   PDF export never completes.
   The LibreOffice process becomes unresponsive.
   No validation error or warning is shown.
   The process must be force‑terminated.

Expected Results:

Writer should handle invalid page geometry safely, for example by:
   Rejecting page styles where margins exceed the page size.
   Automatically clamping margins when the page size is reduced.
   Displaying a clear error or warning.
   Aborting the export gracefully with an error.

At minimum, PDF export must not hang indefinitely due to invalid page style
geometry.

Reproducible: Always

User Profile Reset: No


Additional Information:

Version: 26.2.1.2 (X86\_64)  
Build ID: 620(Build:2)  
CPU threads: 20  
OS: Windows 11 X86\_64 (build 26200)  
UI render: Skia/Vulkan  
VCL: win  
Locale: en-US (en\_US)  
UI: en-US  
Calc: CL threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to