external/pdfium/UnpackedTarball_pdfium.mk |    3 ++
 external/pdfium/ofz451333752.patch        |   38 ++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

New commits:
commit d60ff8c8bd4e3ebf8f84f53448ead3c838332ea9
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Oct 12 20:30:00 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Oct 13 00:13:37 2025 +0200

    ofz#451333752 Out-of-memory
    
    possibly similar to:
    
    https://issues.chromium.org/issues/41480194
    https://issues.chromium.org/issues/40837195
    https://issues.chromium.org/issues/374483185
    
    Change-Id: Ie8f2b306c7626fff06be0c64b7a4ddd8c2a07039
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192256
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index c8266d2ccc8b..a9485ba8807f 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -27,6 +27,9 @@ ifeq ($(OS),WNT)
 pdfium_patches += pdfium-vs2019-arm64_no-__umulh.patch.1
 endif
 
+# TODO, attempt upstream
+pdfium_patches += ofz451333752.patch
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/ofz451333752.patch 
b/external/pdfium/ofz451333752.patch
new file mode 100644
index 000000000000..9789fc7d4d7b
--- /dev/null
+++ b/external/pdfium/ofz451333752.patch
@@ -0,0 +1,38 @@
+--- core/fpdfapi/page/cpdf_form.h
++++ core/fpdfapi/page/cpdf_form.h
+@@ -28,7 +28,22 @@
+     RecursionState();
+     ~RecursionState();
+ 
++    // returns false if that form is already getting parsed
++    bool PushForm(CPDF_Stream* pForm)
++    {
++      if (std::find(current_forms.begin(), current_forms.end(), pForm) != 
current_forms.end())
++        return false;
++      current_forms.push_back(pForm);
++      return true;
++    }
++
++    void PopForm()
++    {
++      current_forms.pop_back();
++    }
++
+     std::set<const uint8_t*> parsed_set;
++    std::vector<CPDF_Stream*> current_forms;
+   };
+ 
+   // Helper method to choose the first non-null resources dictionary.
+--- core/fpdfapi/page/cpdf_streamcontentparser.cpp
++++ core/fpdfapi/page/cpdf_streamcontentparser.cpp
+@@ -754,7 +754,10 @@
+ 
+   const ByteString type = pXObject->GetDict()->GetByteStringFor("Subtype");
+   if (type == "Form") {
++    if (!m_RecursionState->PushForm(pXObject.Get()))
++        return;
+     AddForm(std::move(pXObject), name);
++    m_RecursionState->PopForm();
+     return;
+   }
+ 

Reply via email to