vcl/source/gdi/pdfwriter_impl.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 48271742a062b0fbdedfe9396f942d3f9b5ce46d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Jun 20 15:47:43 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jun 20 18:00:21 2022 +0200

    Use of uninitialised value of size 8 on export to pdf
    
    ==2899330== Use of uninitialised value of size 8
    ==2899330==    at 0xCABB82A: (anonymous namespace)::appendHex(signed char, 
rtl::OStringBuffer&) (pdfwriter_impl.cxx:120)
    ==2899330==    by 0xCAEB14C: vcl::PDFWriterImpl::emitTrailer() 
(pdfwriter_impl.cxx:5466)
    ==2899330==    by 0xCAEDA09: vcl::PDFWriterImpl::emit() 
(pdfwriter_impl.cxx:5773)
    ==2899330==    by 0xCA9F10C: vcl::PDFWriter::Emit() (pdfwriter.cxx:53)
    ==2899330==    by 0x3D5FE329: PDFExport::Export(rtl::OUString const&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) 
(pdfexport.cxx:1012)
    
    an issue since...
    
    commit be39eba9a3d81e20c42f1073a365e91ce855c1cd
    Date:   Mon Jun 6 00:17:02 2022 +0200
    
        Use same glyph width in PDF drawing and font subset
    
    Change-Id: I72dbcf2bb7934c9f911c7c5c3035d3d166e9521a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136183
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4ae1d9f5d242..ae78eda251e5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2666,10 +2666,12 @@ bool PDFWriterImpl::emitFonts()
             sal_Int32 pCodeUnitsPerGlyph[ 256 ] = {};
             std::vector<sal_Ucs> aCodeUnits;
             aCodeUnits.reserve( 256 );
-            int nGlyphs = 1;
             // fill arrays and prepare encoding index map
             sal_Int32 nToUnicodeStream = 0;
 
+            pWidths[0] = 0; // if it gets used then it will appear in 
s_subset.m_aMapping, otherwise 0 is fine
+            int nGlyphs = 1;
+
             for (auto const& item : s_subset.m_aMapping)
             {
                 sal_uInt8 nEnc = item.second.getGlyphId();

Reply via email to