download.lst                                                                |  
  4 
 external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1 |  
 27 
 external/poppler/UnpackedTarball_poppler.mk                                 |  
  1 
 external/poppler/poppler-config.patch.1                                     |  
 12 
 i18npool/source/localedata/data/kmr_Latn_TR.xml                             |  
 13 
 sc/CppunitTest_sc_pdf_export.mk                                             |  
 97 +++
 sc/Module_sc.mk                                                             |  
  1 
 sc/qa/extras/scpdfexport.cxx                                                |  
284 ++++++++++
 sc/source/ui/inc/printfun.hxx                                               |  
  5 
 sc/source/ui/unoobj/docuno.cxx                                              |  
  3 
 sc/source/ui/view/printfun.cxx                                              |  
 23 
 stoc/source/corereflection/criface.cxx                                      |  
  2 
 sw/source/core/text/itradj.cxx                                              |  
 11 
 sw/source/core/text/portxt.cxx                                              |  
  3 
 sw/source/core/txtnode/fntcache.cxx                                         |  
  9 
 sw/source/ui/misc/outline.cxx                                               |  
 27 
 16 files changed, 485 insertions(+), 37 deletions(-)

New commits:
commit 3929f1d2150a4c02a12d849ec2dcc5af564ce247
Merge: bff470b5826b 078dbe815940
Author:     Thorsten Behrens <thorsten.behr...@cib.de>
AuthorDate: Wed Mar 27 11:57:27 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Wed Mar 27 11:57:27 2019 +0100

    Merge branch 'libreoffice-6-1'
    
    into distro/lhm/libreoffice-6-1+backports
    
    Change-Id: Iad85f13e091b739e7df5cf273c14ba923b60f9cd

commit 078dbe815940018705a5c69ddb8ac9d1897689c1
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Mon Mar 25 22:33:03 2019 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Tue Mar 26 17:13:08 2019 +0100

    Assign [kmr-Latn-TR] TRY|₺ currency, TRY|YTL and TRL|TL are legacyOnly
    
    This was done long ago for the tr-TR locale as well.
    
    Change-Id: I5bf8595f6d49adb7fd76b3c4924c4d72b3b8ea5e
    Reviewed-on: https://gerrit.libreoffice.org/69717
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 4ca9db953d59d93ce8e3a54a36d23ed52b9c62a9)
    Reviewed-on: https://gerrit.libreoffice.org/69723
    Tested-by: Eike Rathke <er...@redhat.com>
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/i18npool/source/localedata/data/kmr_Latn_TR.xml 
b/i18npool/source/localedata/data/kmr_Latn_TR.xml
index 2762df9e630f..a566c67170b9 100644
--- a/i18npool/source/localedata/data/kmr_Latn_TR.xml
+++ b/i18npool/source/localedata/data/kmr_Latn_TR.xml
@@ -52,7 +52,7 @@
     <TimePM>PN</TimePM>
     <MeasurementSystem>US</MeasurementSystem>
   </LC_CTYPE>
-  <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$TL-626]">
+  <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$₺-626]">
     <DateAcceptancePattern>M/D</DateAcceptancePattern>
     <FormatElement msgid="FixedFormatskey1" default="true" type="medium" 
usage="FIXED_NUMBER" formatindex="0">
       <FormatCode>General</FormatCode>
@@ -335,14 +335,21 @@
     </Calendar>
   </LC_CALENDAR>
   <LC_CURRENCY>
-    <Currency default="true" usedInCompatibleFormatCodes="false">
+    <Currency default="true" usedInCompatibleFormatCodes="true">
+      <CurrencyID>TRY</CurrencyID>
+      <CurrencySymbol>₺</CurrencySymbol>
+      <BankSymbol>TRY</BankSymbol>
+      <CurrencyName>Türk Lirası</CurrencyName>
+      <DecimalPlaces>2</DecimalPlaces>
+    </Currency>
+    <Currency default="false" usedInCompatibleFormatCodes="false" 
legacyOnly="true">
       <CurrencyID>TRY</CurrencyID>
       <CurrencySymbol>YTL</CurrencySymbol>
       <BankSymbol>TRY</BankSymbol>
       <CurrencyName>Yeni Türk Lirası</CurrencyName>
       <DecimalPlaces>2</DecimalPlaces>
     </Currency>
-    <Currency default="false" usedInCompatibleFormatCodes="true">
+    <Currency default="false" usedInCompatibleFormatCodes="false" 
legacyOnly="true">
       <CurrencyID>TRL</CurrencyID>
       <CurrencySymbol>TL</CurrencySymbol>
       <BankSymbol>TRL</BankSymbol>
commit be189bfc1709dce48111eed49d847c05ef82164e
Author:     Khaled Hosny <khaledho...@eglug.org>
AuthorDate: Thu Mar 21 15:00:22 2019 +0200
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Fri Mar 22 10:02:28 2019 +0100

    tdf#124109: Revert "Only do kashida insertion with fonts that have non-zero 
width kashidas"
    
    This reverts commit c45b23377bb2fe44c26f1287ff38495344e4ca50.
    
    This commit breaks Kashida justification when a document is first opened 
(the
    kashida justification will be disabled and spaces will be used untill the 
text
    is changed). Probably it is checking for width of Kashida glyph too early. 
Also
    I'm not sure what the reverted commit was trying to fix since we already do
    kashida justification in fonts that has non-zero width Kashida and it has 
been
    the case for a long time.
    
    This does not fix the original issue in the document attched with the bug
    report, but if fixes kashida not being applied when opening the document.
    
    Change-Id: Ic95859bca94fa792793e3223d2adb465bc6d880f
    Reviewed-on: https://gerrit.libreoffice.org/69509
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>
    (cherry picked from commit 0a8e9cc5c1782f1cd50ef338ec2aa4f6776a4c0e)
    Reviewed-on: https://gerrit.libreoffice.org/69519
    Reviewed-by: Khaled Hosny <khaledho...@eglug.org>

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 8383292105bc..bacc39e348b1 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -113,9 +113,6 @@ void SwTextAdjuster::FormatBlock( )
 static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTextSizeInfo& 
rInf, SwTextIter& rItr,
             sal_Int32& rKashidas, TextFrameIndex& nGluePortion)
 {
-    if ( rInf.GetOut()->GetMinKashida() <= 0 )
-        return false;
-
     // i60594 validate Kashida justification
     TextFrameIndex nIdx = rItr.GetStart();
     TextFrameIndex nEnd = rItr.GetEnd();
@@ -153,6 +150,12 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf,
         sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
         if (nKashidasInAttr > 0)
         {
+            // Kashida glyph looks suspicious, skip Kashida justification
+            if ( rInf.GetOut()->GetMinKashida() <= 0 )
+            {
+                return false;
+            }
+
             sal_Int32 nKashidasDropped = 0;
             if ( !SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - 
nIdx ) )
             {
@@ -212,7 +215,7 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, 
SwTextSizeInfo& rInf, SwT
             sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( nullptr, nullptr, 
nIdx, nNext - nIdx );
 
             long nFontMinKashida = rInf.GetOut()->GetMinKashida();
-            if ( nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( 
rInf.GetText(), nIdx, nNext - nIdx ) )
+            if ( nFontMinKashida && nKashidasInAttr > 0 && 
SwScriptInfo::IsArabicText( rInf.GetText(), nIdx, nNext - nIdx ) )
             {
                 sal_Int32 nKashidasDropped = 0;
                 while ( rKashidas && nGluePortion && nKashidasInAttr > 0 &&
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 69593f8d157c..f520130458e2 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -115,8 +115,7 @@ static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo 
&rInf,
     // Kashida Justification: Insert Kashidas
     if ( nEnd > nPos && pSI && COMPLEX == nScript )
     {
-        if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
rInf.GetOut()->GetMinKashida()
-            && pSI->CountKashida() )
+        if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && 
pSI->CountKashida() )
         {
             const sal_Int32 nKashRes = pSI->KashidaJustify( nullptr, nullptr, 
nPos, nEnd - nPos );
             // i60591: need to check result of KashidaJustify
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index a0a38aa94364..5c7ab0e0ad93 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1249,8 +1249,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 // Kashida Justification
                 if ( SwFontScript::CTL == nActual && nSpaceAdd )
                 {
-                    if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
-                        && rInf.GetOut().GetMinKashida() )
+                    if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
                     {
                         if ( pSI && pSI->CountKashida() &&
                             pSI->KashidaJustify( pKernArray.get(), nullptr, 
rInf.GetIdx(),
@@ -1456,8 +1455,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
             // Kashida Justification
             if ( SwFontScript::CTL == nActual && nSpaceAdd )
             {
-                if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() )
-                    && rInf.GetOut().GetMinKashida() )
+                if ( SwScriptInfo::IsArabicText( rInf.GetText(), 
rInf.GetIdx(), rInf.GetLen() ) )
                 {
                     if ( pSI && pSI->CountKashida() &&
                          pSI->KashidaJustify( pKernArray.get(), 
pScrArray.get(), rInf.GetIdx(),
@@ -2053,8 +2051,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo 
&rInf)
         // Kashida Justification
         if ( SwFontScript::CTL == nActual && rInf.GetSpace() )
         {
-            if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), 
rInf.GetLen() )
-                && rInf.GetOut().GetMinKashida() )
+            if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), 
rInf.GetLen() ) )
             {
                 if ( pSI && pSI->CountKashida() &&
                     pSI->KashidaJustify( pKernArray.get(), nullptr, 
rInf.GetIdx(), rInf.GetLen(),
commit df3fed52760a72b2a729f7b685adaa2da86d7f76
Author:     Juergen Funk <juergen.funk...@cib.de>
AuthorDate: Thu Mar 21 09:22:03 2019 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Mar 21 14:23:46 2019 +0100

    pUnoReturn should be null when UNO methode is VOID
    
    the problem is that at least the msvc_win32_x86-64 bridge's
    unoInterfaceProxyDispatch
    (bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx)
    requires pUnoReturn to be a nullptr when the UNO method has VOID
    return type (see computation of retKind in cpp_call in the same file),
    but that IdlInterfaceMethodImpl::invoke doesn't set up the arguments
    according to that expectation.
    
    
    Change-Id: I187a997300571cd9822de2eeacf7ad887ad00a4f
    Reviewed-on: https://gerrit.libreoffice.org/69495
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    Tested-by: Stephan Bergmann <sberg...@redhat.com>
    (cherry picked from commit 14a11ab5dfa2ea34049866517ee78170922aee4e)
    Reviewed-on: https://gerrit.libreoffice.org/69502
    Tested-by: Jenkins

diff --git a/stoc/source/corereflection/criface.cxx 
b/stoc/source/corereflection/criface.cxx
index 25839f741f5f..4ce3b0fc8ae0 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -594,7 +594,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & 
rObj, Sequence< Any > &
         // end of a "short" struct by writing the full contents of a "long"
         // register); so create enough space here (assuming that no ABI 
requires
         // padding larger than 16 byte boundaries):
-        void * pUnoReturn = alloca( multipleOf16(pReturnType->nSize) );
+        void * pUnoReturn = (pReturnType->nSize == 0) ? nullptr : alloca( 
multipleOf16(pReturnType->nSize) );
         void ** ppUnoArgs = static_cast<void **>(alloca( sizeof(void *) * 
nParams *2 ));
         typelib_TypeDescription ** ppParamTypes = 
reinterpret_cast<typelib_TypeDescription **>(ppUnoArgs + nParams);
 
commit b407d93a055eb2875dfaac9836b082230efe4eff
Author:     Serge Krot <serge.k...@cib.de>
AuthorDate: Mon Mar 11 10:24:53 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Wed Mar 20 10:42:17 2019 +0100

    tdf#120161 sc: pdf export unit test
    
    Change-Id: I42579d4d61be43318f7e2b06b3465890dd624a12
    Reviewed-on: https://gerrit.libreoffice.org/69035
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    (cherry picked from commit 87bf5a930a72a12f88a21b450da0dd86348c3077)
    Reviewed-on: https://gerrit.libreoffice.org/69412

diff --git a/sc/CppunitTest_sc_pdf_export.mk b/sc/CppunitTest_sc_pdf_export.mk
new file mode 100644
index 000000000000..be938026323c
--- /dev/null
+++ b/sc/CppunitTest_sc_pdf_export.mk
@@ -0,0 +1,97 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_pdf_export))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_pdf_export, \
+    sc/qa/extras/scpdfexport \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sc_pdf_export, \
+    boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_pdf_export, \
+    comphelper \
+    cppu \
+    editeng \
+    sal \
+    sax \
+    sc \
+    sfx \
+    svl \
+    test \
+    tl \
+    unotest \
+    utl \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_pdf_export,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_pdf_export,\
+    udkapi \
+    offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_pdf_export))
+$(eval $(call gb_CppunitTest_use_vcl,sc_pdf_export))
+
+$(eval $(call gb_CppunitTest_use_components,sc_pdf_export,\
+    basic/util/sb \
+    comphelper/util/comphelp \
+    configmgr/source/configmgr \
+    dbaccess/util/dba \
+    eventattacher/source/evtatt \
+    filter/source/config/cache/filterconfig1 \
+    filter/source/pdf/pdffilter \
+    filter/source/storagefilterdetect/storagefd \
+    forms/util/frm \
+    framework/util/fwk \
+    i18npool/source/search/i18nsearch \
+    i18npool/util/i18npool \
+    linguistic/source/lng \
+    oox/util/oox \
+    package/source/xstor/xstor \
+    package/util/package2 \
+    sax/source/expatwrap/expwrap \
+    scripting/source/basprov/basprov \
+    scripting/source/dlgprov/dlgprov \
+    scripting/source/vbaevents/vbaevents \
+    scripting/util/scriptframe \
+    sc/util/sc \
+    sc/util/scd \
+    sc/util/scfilt \
+    $(call gb_Helper_optional,SCRIPTING, \
+        sc/util/vbaobj) \
+    sfx2/util/sfx \
+    sot/util/sot \
+    svl/source/fsstor/fsstorage \
+    svtools/util/svt \
+    svx/util/svx \
+    svx/util/svxcore \
+    toolkit/util/tk \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    ucb/source/ucp/tdoc/ucptdoc1 \
+    unotools/util/utl \
+    unoxml/source/rdf/unordf \
+    unoxml/source/service/unoxml \
+    uui/util/uui \
+    vcl/vcl.common \
+    vbahelper/util/msforms \
+    xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_pdf_export))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 35277496202a..0fc331e22cd1 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -61,6 +61,7 @@ endif
 $(eval $(call gb_Module_add_slowcheck_targets,sc, \
        CppunitTest_sc_cond_format_merge \
        CppunitTest_sc_new_cond_format_api \
+       CppunitTest_sc_pdf_export \
        CppunitTest_sc_subsequent_filters_test \
        CppunitTest_sc_subsequent_export_test \
        CppunitTest_sc_html_export_test \
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
new file mode 100644
index 000000000000..02f00f8fac5d
--- /dev/null
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -0,0 +1,284 @@
+/* -*- 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 <sal/config.h>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <test/bootstrapfixture.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotest/macros_test.hxx>
+#include <docsh.hxx>
+#include <editutil.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/fontitem.hxx>
+#include <osl/file.hxx>
+#include <comphelper/processfactory.hxx>
+
+using namespace css::lang;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+class ScPDFExportTest : public test::BootstrapFixture, public 
unotest::MacrosTest
+{
+    Reference<XComponent> mxComponent;
+    Reference<frame::XFrame> xTargetFrame;
+
+public:
+    ScPDFExportTest() {}
+
+    virtual void setUp() override final;
+    virtual void tearDown() override final;
+
+    // helpers
+private:
+    std::shared_ptr<utl::TempFile> exportToPdf(uno::Reference<frame::XModel>& 
xModel,
+                                               const ScRange& range);
+
+    static bool hasFontInPdf(const std::shared_ptr<utl::TempFile>& pXPathFile,
+                             const char* sFontName, bool& bFound);
+
+    void setFont(ScFieldEditEngine& rEE, sal_Int32 nStart, sal_Int32 nEnd,
+                 const OUString& rFontName);
+
+    // unit tests
+public:
+    void testExportRange_Tdf120161();
+
+    CPPUNIT_TEST_SUITE(ScPDFExportTest);
+    CPPUNIT_TEST(testExportRange_Tdf120161);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void ScPDFExportTest::setUp()
+{
+    test::BootstrapFixture::setUp();
+
+    mxDesktop.set(
+        
css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+
+    {
+        uno::Reference<frame::XDesktop2> xDesktop = mxDesktop;
+        CPPUNIT_ASSERT(xDesktop.is());
+
+        // Create spreadsheet
+        uno::Sequence<beans::PropertyValue> args(1);
+        args[0].Name = "Hidden";
+        args[0].Value <<= true;
+        mxComponent = xDesktop->loadComponentFromURL("private:factory/scalc", 
"_blank", 0, args);
+        CPPUNIT_ASSERT(mxComponent.is());
+
+        // create a frame
+        xTargetFrame = xDesktop->findFrame("_blank", 0);
+        CPPUNIT_ASSERT(xTargetFrame.is());
+
+        uno::Reference<frame::XModel> xModel
+            = uno::Reference<frame::XModel>(mxComponent, uno::UNO_QUERY);
+        uno::Reference<frame::XModel2> xModel2(xModel, UNO_QUERY);
+        CPPUNIT_ASSERT(xModel2.is());
+
+        Reference<frame::XController2> xController(
+            xModel2->createDefaultViewController(xTargetFrame), UNO_QUERY);
+        CPPUNIT_ASSERT(xController.is());
+
+        // introduce model/view/controller to each other
+        xController->attachModel(xModel2.get());
+        xModel2->connectController(xController.get());
+
+        xTargetFrame->setComponent(xController->getComponentWindow(), 
xController.get());
+        xController->attachFrame(xTargetFrame);
+
+        xModel2->setCurrentController(xController.get());
+    }
+}
+
+void ScPDFExportTest::tearDown()
+{
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    test::BootstrapFixture::tearDown();
+}
+
+bool ScPDFExportTest::hasFontInPdf(const std::shared_ptr<utl::TempFile>& 
pXPathFile,
+                                   const char* sFontName, bool& bFound)
+{
+    SvStream* pStream = pXPathFile->GetStream(StreamMode::STD_READ);
+    CPPUNIT_ASSERT(pStream);
+
+    // get file size
+    pStream->Seek(STREAM_SEEK_TO_END);
+    const std::size_t nFileSize = pStream->Tell();
+    if (nFileSize == 0)
+        return false;
+
+    // read file content
+    char* pBuffer = new char[nFileSize];
+    pStream->Seek(STREAM_SEEK_TO_BEGIN);
+    const std::size_t nRead = pStream->ReadBytes(pBuffer, nFileSize);
+    if (nRead == nFileSize)
+    {
+        const std::string haystack(pBuffer, pBuffer + nFileSize);
+        const std::string needle(sFontName);
+        const std::size_t n = haystack.find(needle);
+        bFound = (n != std::string::npos);
+    }
+    delete[] pBuffer;
+
+    // close and return the status
+    pStream = nullptr;
+    pXPathFile->CloseStream();
+    return (nRead == nFileSize);
+}
+
+std::shared_ptr<utl::TempFile> 
ScPDFExportTest::exportToPdf(uno::Reference<frame::XModel>& xModel,
+                                                            const ScRange& 
range)
+{
+    // create temp file name
+    std::shared_ptr<utl::TempFile> pTempFile(new utl::TempFile());
+    pTempFile->EnableKillingFile();
+    OUString sFileURL = pTempFile->GetURL();
+    // Note: under Windows path path should be with "/" delimiters instead of 
"\\"
+    // due to usage of INetURLObject() that converts "\\" to hexdecimal 
notation.
+    ::osl::FileBase::getFileURLFromSystemPath(sFileURL, sFileURL);
+
+    // get XSpreadsheet
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(xModel, 
uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIndex(xSheets, 
uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheet> rSheet(xIndex->getByIndex(0), 
UNO_QUERY_THROW);
+
+    // select requested cells to print
+    // query for the XCellRange interface
+    uno::Reference<table::XCellRange> rCellRange(rSheet, UNO_QUERY);
+    uno::Reference<table::XCellRange> xCellRange = 
rCellRange->getCellRangeByPosition(
+        range.aStart.Col(), range.aStart.Row(), range.aEnd.Col(), 
range.aEnd.Row());
+    {
+        uno::Reference<frame::XController> xController = 
xModel->getCurrentController();
+        CPPUNIT_ASSERT(xController.is());
+
+        uno::Reference<view::XSelectionSupplier> xSelection(xController, 
uno::UNO_QUERY_THROW);
+        CPPUNIT_ASSERT(xSelection.is());
+
+        uno::Any rCellRangeAny(xCellRange);
+        xSelection->select(rCellRangeAny);
+    }
+
+    // init special pdf export params
+    css::uno::Sequence<css::beans::PropertyValue> aFilterData(3);
+    aFilterData[0].Name = "Selection";
+    aFilterData[0].Value <<= xCellRange;
+    aFilterData[1].Name = "Printing";
+    aFilterData[1].Value <<= sal_Int32(2);
+    aFilterData[2].Name = "ViewPDFAfterExport";
+    aFilterData[2].Value <<= true;
+
+    // init set of params for storeToURL() call
+    css::uno::Sequence<css::beans::PropertyValue> seqArguments(3);
+    seqArguments[0].Name = "FilterData";
+    seqArguments[0].Value <<= aFilterData;
+    seqArguments[1].Name = "FilterName";
+    seqArguments[1].Value <<= OUString("calc_pdf_Export");
+    seqArguments[2].Name = "URL";
+    seqArguments[2].Value <<= sFileURL;
+
+    // call storeToURL()
+    uno::Reference<lang::XComponent> xComponent(mxComponent, UNO_QUERY_THROW);
+    uno::Reference<css::frame::XStorable> xStorable(xComponent, UNO_QUERY);
+    xStorable->storeToURL(sFileURL, seqArguments);
+
+    // return file object with generated PDF
+    return pTempFile;
+}
+
+void ScPDFExportTest::setFont(ScFieldEditEngine& rEE, sal_Int32 nStart, 
sal_Int32 nEnd,
+                              const OUString& rFontName)
+{
+    ESelection aSel;
+    aSel.nStartPara = aSel.nEndPara = 0;
+    aSel.nStartPos = nStart;
+    aSel.nEndPos = nEnd;
+
+    SfxItemSet aItemSet = rEE.GetEmptyItemSet();
+    SvxFontItem aItem(FAMILY_MODERN, rFontName, "", PITCH_VARIABLE, 
RTL_TEXTENCODING_UTF8,
+                      EE_CHAR_FONTINFO);
+    aItemSet.Put(aItem);
+    rEE.QuickSetAttribs(aItemSet, aSel);
+}
+
+// Selection was not taken into account during export into PDF
+void ScPDFExportTest::testExportRange_Tdf120161()
+{
+    // create test document
+    uno::Reference<frame::XModel> xModel
+        = uno::Reference<frame::XModel>(mxComponent, uno::UNO_QUERY);
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(xModel, 
uno::UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIndex(xSheets, 
uno::UNO_QUERY_THROW);
+    xSheets->insertNewByName("First Sheet", 0);
+    uno::Reference<sheet::XSpreadsheet> rSheet(xIndex->getByIndex(0), 
UNO_QUERY_THROW);
+
+    // 2. Setup data
+    {
+        SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(mxComponent);
+        CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+        ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell);
+        CPPUNIT_ASSERT(xDocSh.get() != nullptr);
+
+        // put some content into the first row with default font
+        ScDocument& rDoc = xDocSh->GetDocument();
+        for (unsigned int r = 0; r < 1; ++r)
+            for (unsigned int c = 0; c < 14; ++c)
+                rDoc.SetValue(ScAddress(c, r, 0), (r + 1) * (c + 1));
+
+        // set "Text" to H1 cell with "DejaVuSans" font
+        ScFieldEditEngine& rEE = rDoc.GetEditEngine();
+        rEE.Clear();
+        rEE.SetText("Text");
+        setFont(rEE, 0, 4, "DejaVuSans"); // set font for first 4 chars
+        rDoc.SetEditText(ScAddress(7, 0, 0), rEE.CreateTextObject());
+    }
+
+    // A1:G1
+    {
+        ScRange range1(0, 0, 0, 6, 0, 0);
+        std::shared_ptr<utl::TempFile> pXPathFile = exportToPdf(xModel, 
range1);
+        bool bFound = false;
+        CPPUNIT_ASSERT(hasFontInPdf(pXPathFile, "DejaVuSans", bFound));
+        CPPUNIT_ASSERT_EQUAL(false, bFound);
+    }
+
+    // G1:H1
+    {
+        ScRange range1(6, 0, 0, 7, 0, 0);
+        std::shared_ptr<utl::TempFile> pXPathFile = exportToPdf(xModel, 
range1);
+        bool bFound = false;
+        CPPUNIT_ASSERT(hasFontInPdf(pXPathFile, "DejaVuSans", bFound));
+        CPPUNIT_ASSERT_EQUAL(true, bFound);
+    }
+
+    // H1:I1
+    {
+        ScRange range1(7, 0, 0, 8, 0, 0);
+        std::shared_ptr<utl::TempFile> pXPathFile = exportToPdf(xModel, 
range1);
+        bool bFound = false;
+        CPPUNIT_ASSERT(hasFontInPdf(pXPathFile, "DejaVuSans", bFound));
+        CPPUNIT_ASSERT_EQUAL(true, bFound);
+    }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScPDFExportTest);
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0c70e9ab4713a50fec558d6c4e4dfb2517039fc8
Author:     Serge Krot <serge.k...@cib.de>
AuthorDate: Wed Mar 6 23:49:54 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Mar 19 10:23:23 2019 +0100

    tdf#120161 sc: use selection to set required printed area
    
    Change-Id: Id0798cbff2d327e2bb955fbbc530a201975f6003
    Reviewed-on: https://gerrit.libreoffice.org/68833
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    (cherry picked from commit 03b6c20c66047af41ed2f78fe5dd229cd06392e8)
    Reviewed-on: https://gerrit.libreoffice.org/69118
    Reviewed-by: Serge Krot (CIB) <serge.k...@cib.de>
    Tested-by: Serge Krot (CIB) <serge.k...@cib.de>
    (cherry picked from commit f0b71fafd3a2fd6158c5952d601092179cba21e5)
    Reviewed-on: https://gerrit.libreoffice.org/69263

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1fd3c9158d7f..1d0928c34cbe 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1971,7 +1971,8 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, 
const uno::Any& aSelec
 
 
     std::unique_ptr<ScPrintFunc, o3tl::default_delete<ScPrintFunc>> pPrintFunc;
-    if (m_pPrintState && m_pPrintState->nPrintTab == nTab)
+    if (m_pPrintState && m_pPrintState->nPrintTab == nTab
+        && ! pSelRange) // tdf#120161 use selection to set required printed 
area
         pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, *m_pPrintState, 
&aStatus.GetOptions()));
     else
         pPrintFunc.reset(new ScPrintFunc(pDev, pDocShell, nTab, 
pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, 
&aStatus.GetOptions()));
commit b0464b42d1416a521e6ce0e492f1628b5fb46910
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Mar 5 12:41:44 2019 +0100
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Thu Mar 14 15:18:00 2019 +0100

    do not access uninitialized values when printing (tdf#121439)
    
    The assert in the bugreport is triggered by ScPrintFunc::CalcPages() passing
    uninitialized values of nEndRow (and others). These variables apparently
    get initialized only by constructors that take ScPrintState. These ctors
    also set (the somewhat poorly named) bState and the call to CalcPages()
    is guarded by this. However, GetPrintState() will simply create ScPrintState
    filled with these uninitialized values and later on this will be used
    with these ctors, so bState will be set, but nEndRow will be bogus.
    
    Although 5217a2a0bf27e496cc429ee45dff7c239b466ae6 introduced tdf#121439,
    this strange bState logic and unitialized variables has been these since
    the initial commit, and the code doesn't take any precautions to check
    whether the values are valid or not, so I assume this always was just lucky
    enough to work and 5217a2a0bf finally triggered a problem.
    
    Given that it's rather unclear to me how this is supposed to work properly,
    just add an extra flag to both ScPrintFunc and ScPrintState marking whether
    the values are set or not and make CalcPages() depends on this flag instead.
    
    Change-Id: I0620de6562865c24f5a0edca2566b01546bf2e2b
    Reviewed-on: https://gerrit.libreoffice.org/68739
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins
    (cherry picked from commit 9432bab9f8f4a246d205ff2a460f60aeedba8ce1)
    Reviewed-on: https://gerrit.libreoffice.org/69262
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>
    Tested-by: Xisco Faulí <xiscofa...@libreoffice.org>

diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 2df47432c89a..fd2f486ac5ce 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -153,6 +153,7 @@ struct ScPrintState                         //  Save 
Variables from ScPrintFunc
     SCROW   nStartRow;
     SCCOL   nEndCol;
     SCROW   nEndRow;
+    bool    bPrintAreaValid; // the 4 variables above are set
     sal_uInt16  nZoom;
     size_t  nPagesX;
     size_t  nPagesY;
@@ -175,6 +176,7 @@ struct ScPrintState                         //  Save 
Variables from ScPrintFunc
         , nStartRow(0)
         , nEndCol(0)
         , nEndRow(0)
+        , bPrintAreaValid(false)
         , nZoom(0)
         , nPagesX(0)
         , nPagesY(0)
@@ -212,7 +214,7 @@ private:
     const ScRange*      pUserArea;          //  Selection, if set in dialog
 
     const SfxItemSet*   pParamSet;          //  Selected template
-    bool                bState;             // created from State-struct
+    bool                bFromPrintState;    // created from State-struct
 
                                             //  Parameter from template:
     sal_uInt16          nLeftMargin;
@@ -261,6 +263,7 @@ private:
     SCROW               nStartRow;
     SCCOL               nEndCol;
     SCROW               nEndRow;
+    bool                bPrintAreaValid; // the 4 variables above are set
 
     sc::PrintPageRanges m_aRanges;
 
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 4ddc1f64f0ce..59d5ed9ca96f 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -191,7 +191,7 @@ void ScPrintFunc::Construct( const ScPrintOptions* pOptions 
)
         pParamSet = nullptr;
     }
 
-    if (!bState)
+    if (!bFromPrintState)
         nZoom = 100;
     nManualZoom = 100;
     bClearWin = false;
@@ -214,13 +214,14 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* 
pNewPrinter, SCTAB nTa
         nPageStart          ( nPage ),
         nDocPages           ( nDocP ),
         pUserArea           ( pArea ),
-        bState              ( false ),
+        bFromPrintState     ( false ),
         bSourceRangeValid   ( false ),
         bPrintCurrentTable  ( false ),
         bMultiArea          ( false ),
         mbHasPrintRange(true),
         nTabPages           ( 0 ),
         nTotalPages         ( 0 ),
+        bPrintAreaValid     ( false ),
         pPageData           ( pData )
 {
     pDev = pPrinter.get();
@@ -247,6 +248,7 @@ ScPrintFunc::ScPrintFunc(ScDocShell* pShell, SfxPrinter* 
pNewPrinter,
     nStartRow   = rState.nStartRow;
     nEndCol     = rState.nEndCol;
     nEndRow     = rState.nEndRow;
+    bPrintAreaValid = rState.bPrintAreaValid;
     nZoom       = rState.nZoom;
     m_aRanges.m_nPagesX = rState.nPagesX;
     m_aRanges.m_nPagesY = rState.nPagesY;
@@ -254,7 +256,7 @@ ScPrintFunc::ScPrintFunc(ScDocShell* pShell, SfxPrinter* 
pNewPrinter,
     nTotalPages = rState.nTotalPages;
     nPageStart  = rState.nPageStart;
     nDocPages   = rState.nDocPages;
-    bState      = true;
+    bFromPrintState = true;
 
     if (rState.bSavedStateRanges)
     {
@@ -279,13 +281,14 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, 
ScDocShell* pShell, SCTAB nTab,
         nPageStart          ( nPage ),
         nDocPages           ( nDocP ),
         pUserArea           ( pArea ),
-        bState              ( false ),
+        bFromPrintState     ( false ),
         bSourceRangeValid   ( false ),
         bPrintCurrentTable  ( false ),
         bMultiArea          ( false ),
         mbHasPrintRange(true),
         nTabPages           ( 0 ),
         nTotalPages         ( 0 ),
+        bPrintAreaValid     ( false ),
         pPageData           ( nullptr )
 {
     pDev = pOutDev;
@@ -311,6 +314,7 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, 
ScDocShell* pShell,
     nStartRow   = rState.nStartRow;
     nEndCol     = rState.nEndCol;
     nEndRow     = rState.nEndRow;
+    bPrintAreaValid = rState.bPrintAreaValid;
     nZoom       = rState.nZoom;
     m_aRanges.m_nPagesX = rState.nPagesX;
     m_aRanges.m_nPagesY = rState.nPagesY;
@@ -318,7 +322,7 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, 
ScDocShell* pShell,
     nTotalPages = rState.nTotalPages;
     nPageStart  = rState.nPageStart;
     nDocPages   = rState.nDocPages;
-    bState      = true;
+    bFromPrintState = true;
 
     if (rState.bSavedStateRanges)
     {
@@ -339,6 +343,7 @@ void ScPrintFunc::GetPrintState(ScPrintState& rState,  bool 
bSavePageRanges)
     rState.nStartRow    = nStartRow;
     rState.nEndCol      = nEndCol;
     rState.nEndRow      = nEndRow;
+    rState.bPrintAreaValid = bPrintAreaValid;
     rState.nZoom        = nZoom;
     rState.nPagesX      = m_aRanges.m_nPagesX;
     rState.nPagesY      = m_aRanges.m_nPagesY;
@@ -370,6 +375,7 @@ void ScPrintFunc::FillPageData()
         sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( 
pPageData->GetCount() );
         ScPrintRangeData& rData = pPageData->GetData(nCount);       // count up
 
+        assert( bPrintAreaValid );
         rData.SetPrintRange( ScRange( nStartCol, nStartRow, nPrintTab,
                                         nEndCol, nEndRow, nPrintTab ) );
         // #i123672#
@@ -697,6 +703,7 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
         nStartRow = 0;
         if (!pDoc->GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes ))
             return false;   // nothing
+        bPrintAreaValid = true;
     }
     else
     {
@@ -735,10 +742,12 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
         if (!bFound)
             return false;   // empty
 
+        bPrintAreaValid = true;
         if (bForcedChangeRow)
             bChangeRow = true;
     }
 
+    assert( bPrintAreaValid );
     pDoc->ExtendMerge( nStartCol,nStartRow, nEndCol,nEndRow, nPrintTab );  // 
no Refresh, incl. Attrs
 
     if ( bChangeCol )
@@ -1058,7 +1067,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* 
pOptions )
 
             //  Split pages
 
-    if (!bState)
+    if (!bPrintAreaValid)
     {
         nTabPages = CountPages();                                   // also 
calculates zoom
         nTotalPages = nTabPages;
@@ -2546,6 +2555,7 @@ long ScPrintFunc::CountNotePages()
 
         if (bDoThis)
         {
+            assert( bPrintAreaValid );
             for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
             {
                 if (pDoc->HasColNotes(nCol, nPrintTab))
@@ -3005,6 +3015,7 @@ static void lcl_SetHidden( const ScDocument* pDoc, SCTAB 
nPrintTab, ScPageRowEnt
 
 void ScPrintFunc::CalcPages()               // calculates aPageRect and pages 
from nZoom
 {
+    assert( bPrintAreaValid );
     m_aRanges.calculate(pDoc, aTableParam.bSkipEmpty, aAreaParam.bPrintArea, 
nStartRow, nEndRow, nStartCol, nEndCol, nPrintTab, GetDocPageSize());
 }
 
commit 718e49e1f4281cfc77d05e537aab0cf701f6e341
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Tue Feb 19 23:24:58 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Wed Mar 13 17:00:40 2019 +0100

    tdf#123547: do the same as in lcl_DrawBullet from cui/numpages.cxx
    
    See bt https://bugs.documentfoundation.org/attachment.cgi?id=149389
    It seems the method from cui/numpages.cxx takes more things into account
    
    At least, it doesn't crash for the attachment of this tracker
    
    Change-Id: I05ca0b019ac483890bea4acdbb695d73b660e638
    Reviewed-on: https://gerrit.libreoffice.org/68033
    Tested-by: Jenkins
    (cherry picked from commit 684fcf2fce915f3e3e553c67fb57bdbfc8f159d5)
    Reviewed-on: https://gerrit.libreoffice.org/68843
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit 7f2322afea3b25bc45f438b8ae9d4977ac378c1c)
    Reviewed-on: https://gerrit.libreoffice.org/69172
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index c23794861501..23bb9c66ca4d 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -822,13 +822,30 @@ static long lcl_DrawBullet(vcl::RenderContext* pVDev, 
const SwNumFormat& rFormat
 {
     vcl::Font aTmpFont(pVDev->GetFont());
 
-    vcl::Font aFont(*rFormat.GetBulletFont());
-    aFont.SetFontSize(rSize);
+    // via Uno it's possible that no font has been set!
+    vcl::Font aFont(rFormat.GetBulletFont() ? *rFormat.GetBulletFont() : 
aTmpFont);
+    Size aTmpSize(rSize);
+    aTmpSize.setWidth( aTmpSize.Width() * ( rFormat.GetBulletRelSize()) );
+    aTmpSize.setWidth( aTmpSize.Width() / 100 ) ;
+    aTmpSize.setHeight( aTmpSize.Height() * ( rFormat.GetBulletRelSize()) );
+    aTmpSize.setHeight( aTmpSize.Height() / 100 ) ;
+    // in case of a height of zero it is drawn in original height
+    if(!aTmpSize.Height())
+        aTmpSize.setHeight( 1 );
+    aFont.SetFontSize(aTmpSize);
     aFont.SetTransparent(true);
-    pVDev->SetFont(aFont);
+    Color aBulletColor = rFormat.GetBulletColor();
+    if(aBulletColor == COL_AUTO)
+        aBulletColor = pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK;
+    else if(aBulletColor == pVDev->GetFillColor())
+        aBulletColor.Invert();
+    aFont.SetColor(aBulletColor);
+    pVDev->SetFont( aFont );
     OUString aText(rFormat.GetBulletChar());
-    pVDev->DrawText(Point(nXStart, nYStart), aText);
-    const long nRet = pVDev->GetTextWidth(aText);
+    long nY = nYStart;
+    nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
+    pVDev->DrawText( Point(nXStart, nY), aText );
+    long nRet = pVDev->GetTextWidth(aText);
 
     pVDev->SetFont(aTmpFont);
     return nRet;
commit 5ed02ae1d3437473d48e9b421e496216e4f3dd76
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Tue Mar 12 12:57:20 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Wed Mar 13 16:57:53 2019 +0100

    poppler: upgrade to release 0.74.0
    
    Fixes CVE-2019-7310.
    
    Add patch to fix CVE-2019-9200 too.
    
    CVE-2018-20662 looks irrelevant because we don't build pdfunite tool.
    
    Reviewed-on: https://gerrit.libreoffice.org/69094
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit f9b354784faf65ecc8024cf6d7d7aaf589f6d91f)
    
    Change-Id: I5e7ddabbb341f6bfefb376d552b50c4006f41906
    Reviewed-on: https://gerrit.libreoffice.org/69119
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/download.lst b/download.lst
index e9941ccc1725..d1c494eddecf 100644
--- a/download.lst
+++ b/download.lst
@@ -206,8 +206,8 @@ export PIXMAN_SHA256SUM := 
21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 
2f1e960d92ce3b3abd03d06dfec9637dfbd22febf107a536b44f7a47c60659f6
 export LIBPNG_TARBALL := libpng-1.6.34.tar.xz
-export POPPLER_SHA256SUM := 
e44b5543903128884ba4538c2a97d3bcc8889e97ffacc4636112101f0238db03
-export POPPLER_TARBALL := poppler-0.73.0.tar.xz
+export POPPLER_SHA256SUM := 
92e09fd3302567fd36146b36bb707db43ce436e8841219025a82ea9fb0076b2f
+export POPPLER_TARBALL := poppler-0.74.0.tar.xz
 export POSTGRESQL_SHA256SUM := 
db61d498105a7d5fe46185e67ac830c878cdd7dc1f82a87f06b842217924c461
 export POSTGRESQL_TARBALL := 
c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
 export PYTHON_SHA256SUM := 
f55cde04f521f273c7cba08912921cc5642cfc15ca7b22d5829f0aff4371155f
diff --git 
a/external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1 
b/external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1
new file mode 100644
index 000000000000..b459a0a0bef7
--- /dev/null
+++ 
b/external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1
@@ -0,0 +1,27 @@
+From f4136a6353162db249f63ddb0f20611622ab61b4 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aa...@kde.org>
+Date: Wed, 27 Feb 2019 19:43:22 +0100
+Subject: [PATCH] ImageStream::getLine: fix crash on broken files
+
+Fixes #728
+---
+ poppler/Stream.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/poppler/Stream.cc b/poppler/Stream.cc
+index 33537b0e..a41435ab 100644
+--- a/poppler/Stream.cc
++++ b/poppler/Stream.cc
+@@ -496,6 +496,9 @@ unsigned char *ImageStream::getLine() {
+   }
+  
+   int readChars = str->doGetChars(inputLineSize, inputLine);
++  if (unlikely(readChars == -1)) {
++      readChars = 0;
++  }
+   for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
+   if (nBits == 1) {
+     unsigned char *p = inputLine;
+-- 
+2.20.1
+
diff --git a/external/poppler/UnpackedTarball_poppler.mk 
b/external/poppler/UnpackedTarball_poppler.mk
index 5b91e1628ba6..151fa5d0444f 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -14,6 +14,7 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,poppler,$(POPPLER_TARBALL),,poppler
 $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
        external/poppler/poppler-config.patch.1 \
        external/poppler/poppler-c++11.patch.1 \
+       
external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1 \
 ))
 
 # std::make_unique is only available in C++14
diff --git a/external/poppler/poppler-config.patch.1 
b/external/poppler/poppler-config.patch.1
index e312573f1ff3..1c68806276f7 100644
--- a/external/poppler/poppler-config.patch.1
+++ b/external/poppler/poppler-config.patch.1
@@ -195,7 +195,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_NAME "poppler"
 +
 +/* Define to the full name and version of this package. */
-+#define PACKAGE_STRING "poppler 0.73.0"
++#define PACKAGE_STRING "poppler 0.74.0"
 +
 +/* Define to the one symbol short name of this package. */
 +#define PACKAGE_TARNAME "poppler"
@@ -204,7 +204,7 @@ index 0fbd336a..451213f8 100644
 +#define PACKAGE_URL ""
 +
 +/* Define to the version of this package. */
-+#define PACKAGE_VERSION "0.73.0"
++#define PACKAGE_VERSION "0.74.0"
 +
 +/* Poppler data dir */
 +#define POPPLER_DATADIR "/usr/local/share/poppler"
@@ -228,7 +228,7 @@ index 0fbd336a..451213f8 100644
 +/* #undef USE_FLOAT */
 +
 +/* Version number of package */
-+#define VERSION "0.73.0"
++#define VERSION "0.74.0"
 +
 +#if defined(__APPLE__)
 +#elif defined (_WIN32)
@@ -304,7 +304,7 @@ index 0fbd336a..451213f8 100644
 +
 +/* Defines the poppler version. */
 +#ifndef POPPLER_VERSION
-+#define POPPLER_VERSION "0.73.0"
++#define POPPLER_VERSION "0.74.0"
 +#endif
 +
 +/* Enable multithreading support. */
@@ -466,9 +466,9 @@ index 0fbd336a..451213f8 100644
 +
 +#include "poppler-global.h"
 +
-+#define POPPLER_VERSION "0.73.0"
++#define POPPLER_VERSION "0.74.0"
 +#define POPPLER_VERSION_MAJOR 0
-+#define POPPLER_VERSION_MINOR 73
++#define POPPLER_VERSION_MINOR 74
 +#define POPPLER_VERSION_MICRO 0
 +
 +namespace poppler
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to