download.lst                                |    4 
 external/libtiff/UnpackedTarball_libtiff.mk |    1 
 external/libtiff/ofz68840.patch             |   17 +
 package/CppunitTest_package2_test.mk        |    3 
 package/qa/cppunit/data/casing.docx         |binary
 package/qa/cppunit/data/dd-deflated.docx    |binary
 package/qa/cppunit/data/dd-stored.docx      |binary
 package/qa/cppunit/data/dot-slash.docx      |binary
 package/qa/cppunit/data/duplicate-files.odt |binary
 package/qa/cppunit/data/inner-gap.docx      |binary
 package/qa/cppunit/data/overlap.docx        |binary
 package/qa/cppunit/data/slash.odt           |binary
 package/qa/cppunit/data/two-zips.docx       |binary
 package/qa/cppunit/data/two-zips.odt        |binary
 package/qa/cppunit/data/unicode-path.docx   |binary
 package/qa/cppunit/data/unicode-path.odt    |binary
 package/qa/cppunit/data/zip64-eocd.docx     |binary
 package/qa/cppunit/test_zippackage.cxx      |  390 ++++++++++++++++++++++++++++
 18 files changed, 413 insertions(+), 2 deletions(-)

New commits:
commit adc7adfd8d24a4cfed46830056c15b6c09e804b2
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jul 5 13:57:16 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Fri Sep 20 10:19:38 2024 +0200

    package: add unit tests with invalid zip packages
    
    Change-Id: I687028391833ea48884912b0e5f586b95eee3244
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170054
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit aeb92985f58629a112b4d1f4d105de8c372735b8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173634
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/package/CppunitTest_package2_test.mk 
b/package/CppunitTest_package2_test.mk
index 546da10deda6..206d8c7e1fb8 100644
--- a/package/CppunitTest_package2_test.mk
+++ b/package/CppunitTest_package2_test.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,package2_test))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,package2_test, \
     package/qa/cppunit/test_package \
+    package/qa/cppunit/test_zippackage \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,package2_test, \
@@ -28,7 +29,9 @@ $(eval $(call gb_CppunitTest_use_sdk_api,package2_test))
 
 $(eval $(call gb_CppunitTest_use_components,package2_test,\
     configmgr/source/configmgr \
+    package/source/xstor/xstor \
     package/util/package2 \
+       sax/source/expatwrap/expwrap \
     ucb/source/core/ucb1 \
     ucb/source/ucp/file/ucpfile1 \
 ))
diff --git a/package/qa/cppunit/data/casing.docx 
b/package/qa/cppunit/data/casing.docx
new file mode 100644
index 000000000000..d8d0dffc71a6
Binary files /dev/null and b/package/qa/cppunit/data/casing.docx differ
diff --git a/package/qa/cppunit/data/dd-deflated.docx 
b/package/qa/cppunit/data/dd-deflated.docx
new file mode 100644
index 000000000000..a4638147ce91
Binary files /dev/null and b/package/qa/cppunit/data/dd-deflated.docx differ
diff --git a/package/qa/cppunit/data/dd-stored.docx 
b/package/qa/cppunit/data/dd-stored.docx
new file mode 100644
index 000000000000..41c19338821d
Binary files /dev/null and b/package/qa/cppunit/data/dd-stored.docx differ
diff --git a/package/qa/cppunit/data/dot-slash.docx 
b/package/qa/cppunit/data/dot-slash.docx
new file mode 100644
index 000000000000..d50cabcbdee2
Binary files /dev/null and b/package/qa/cppunit/data/dot-slash.docx differ
diff --git a/package/qa/cppunit/data/duplicate-files.odt 
b/package/qa/cppunit/data/duplicate-files.odt
new file mode 100644
index 000000000000..cc24f7024ad1
Binary files /dev/null and b/package/qa/cppunit/data/duplicate-files.odt differ
diff --git a/package/qa/cppunit/data/inner-gap.docx 
b/package/qa/cppunit/data/inner-gap.docx
new file mode 100644
index 000000000000..d8e9a232465c
Binary files /dev/null and b/package/qa/cppunit/data/inner-gap.docx differ
diff --git a/package/qa/cppunit/data/overlap.docx 
b/package/qa/cppunit/data/overlap.docx
new file mode 100644
index 000000000000..2d5d115ed800
Binary files /dev/null and b/package/qa/cppunit/data/overlap.docx differ
diff --git a/package/qa/cppunit/data/slash.odt 
b/package/qa/cppunit/data/slash.odt
new file mode 100644
index 000000000000..22c6443499af
Binary files /dev/null and b/package/qa/cppunit/data/slash.odt differ
diff --git a/package/qa/cppunit/data/two-zips.docx 
b/package/qa/cppunit/data/two-zips.docx
new file mode 100644
index 000000000000..720189b20ed9
Binary files /dev/null and b/package/qa/cppunit/data/two-zips.docx differ
diff --git a/package/qa/cppunit/data/two-zips.odt 
b/package/qa/cppunit/data/two-zips.odt
new file mode 100644
index 000000000000..36d90cb9d4d9
Binary files /dev/null and b/package/qa/cppunit/data/two-zips.odt differ
diff --git a/package/qa/cppunit/data/unicode-path.docx 
b/package/qa/cppunit/data/unicode-path.docx
new file mode 100644
index 000000000000..1855aa1e7408
Binary files /dev/null and b/package/qa/cppunit/data/unicode-path.docx differ
diff --git a/package/qa/cppunit/data/unicode-path.odt 
b/package/qa/cppunit/data/unicode-path.odt
new file mode 100644
index 000000000000..9edaaeb68809
Binary files /dev/null and b/package/qa/cppunit/data/unicode-path.odt differ
diff --git a/package/qa/cppunit/data/zip64-eocd.docx 
b/package/qa/cppunit/data/zip64-eocd.docx
new file mode 100644
index 000000000000..1a4dbd0d16b1
Binary files /dev/null and b/package/qa/cppunit/data/zip64-eocd.docx differ
diff --git a/package/qa/cppunit/test_zippackage.cxx 
b/package/qa/cppunit/test_zippackage.cxx
new file mode 100644
index 000000000000..624457ab7bcf
--- /dev/null
+++ b/package/qa/cppunit/test_zippackage.cxx
@@ -0,0 +1,390 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <unotest/bootstrapfixturebase.hxx>
+
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/embed/StorageFormats.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+
+using namespace ::com::sun::star;
+
+class ZipPackageTest : public test::BootstrapFixtureBase
+{
+};
+
+auto const ZipPackage(u"com.sun.star.packages.comp.ZipPackage"_ustr);
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testDuplicate)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/duplicate-files.odt"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testUnicodeODT)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/unicode-path.odt"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testUnicodeDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/unicode-path.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testAbsolutePathODT)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/slash.odt"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testDotPathDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/dot-slash.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testConcatODT)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/two-zips.odt"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testConcatDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/two-zips.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testCaseInsensitiveDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/casing.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::OFOPXML)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testOverlapDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/overlap.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testInnerGapDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/inner-gap.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testDataDescriptorDeflatedDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/dd-deflated.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testDataDescriptorStoredDOCX)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/dd-stored.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::OFOPXML)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::OFOPXML)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testZip64End)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/zip64-eocd.docx"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
+//CPPUNIT_TEST_SUITE_REGISTRATION(...);
+//CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b519007d224252c203014f2cc96bdc7883ce263b
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Sep 18 11:20:43 2024 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Fri Sep 20 10:19:38 2024 +0200

    libtiff: upgrade to release 4.7.0
    
    Fixes CVE-2023-52356 CVE-2024-7006
    
    ofz65182.patch was apparently merged upstream and then reverted;
    Caolán suggested to drop the patch and see if ofz still finds a problem
    there.
    
    Change-Id: I0967708f19a7151b020372eca3c906b30f693db9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173602
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit d838b0d4af154b5c31818ceaac4bcdf8b2214c94)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173654
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/download.lst b/download.lst
index c8bf1faa8502..f159b39d3b84 100644
--- a/download.lst
+++ b/download.lst
@@ -641,8 +641,8 @@ LIBPNG_TARBALL := libpng-1.6.44.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-LIBTIFF_SHA256SUM := 
e178649607d1e22b51cf361dd20a3753f244f022eefab1f2f218fc62ebaf87d2
-LIBTIFF_TARBALL := tiff-4.6.0.tar.xz
+LIBTIFF_SHA256SUM := 
273a0a73b1f0bed640afee4a5df0337357ced5b53d3d5d1c405b936501f71017
+LIBTIFF_TARBALL := tiff-4.7.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
commit b460bb3e36f0cc4a57fa29c7e8717c961a6e44d0
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri May 24 20:43:42 2024 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Fri Sep 20 10:19:38 2024 +0200

    ofz#68840 another putcontig8bitYCbCr22tile issue
    
    Change-Id: I6e119cf1b3bec609f94784eb0c439835875d6112
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168031
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 034b68eb3a015553254c7238b13db8f94514080d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173653
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/external/libtiff/UnpackedTarball_libtiff.mk 
b/external/libtiff/UnpackedTarball_libtiff.mk
index f7eeb6ace868..f268be5926c6 100644
--- a/external/libtiff/UnpackedTarball_libtiff.mk
+++ b/external/libtiff/UnpackedTarball_libtiff.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libtiff,1))
 $(eval $(call gb_UnpackedTarball_add_patches,libtiff,\
     external/libtiff/libtiff.linknolibs.patch \
     external/libtiff/0001-ofz-54685-Timeout.patch \
+    external/libtiff/ofz68840.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libtiff/ofz68840.patch b/external/libtiff/ofz68840.patch
new file mode 100644
index 000000000000..0a8721ebe012
--- /dev/null
+++ b/external/libtiff/ofz68840.patch
@@ -0,0 +1,17 @@
+--- a/libtiff/tif_tile.c
++++ b/libtiff/tif_tile.c
+@@ -233,7 +233,13 @@
+             _TIFFMultiply64(tif, samplingrow_size, samplingblocks_ver, 
module));
+     }
+     else
+-        return (_TIFFMultiply64(tif, nrows, TIFFTileRowSize64(tif), module));
++    {
++        uint64_t row_size = TIFFTileRowSize64(tif);
++        /* I think the way this works the expectation is there are always 
even num of samples */
++        if (td->td_photometric == PHOTOMETRIC_YCBCR)
++            row_size = TIFFroundup_64(row_size, 2);
++        return (_TIFFMultiply64(tif, nrows, row_size, module));
++    }
+ }
+ tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows)
+ {

Reply via email to