[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - filter/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 06:42:48 UTC 2020


 filter/source/graphicfilter/eps/eps.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 6f879fb63a081e8be3cd31c15f1c3fd1c893ef19
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 13 12:41:22 2020 +0200
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Tue Jul 14 08:42:17 2020 +0200

    tdf#134667 filter: EPS export: fix integer unsigned->signed SNAFU
    
    In PSWriter::ImplWriteF(), (nCount + 1) - nLen used to be unsigned long
    but now it's unsigned 32-bit int so on 64-bit platform values > 2^31
    no longer init nStSize to negative values.
    
    (regression from cf82475c785c47327cdc9d591d63d7a82dd1ac53)
    
    Change-Id: Ib17537cf67c80883f10cf2a3b7e38d6a8f8dfcb7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98654
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit af97e1053f79ea4a913c3bd11cc779f355006f38)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98638
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index ee631ff75a46..9958c946310a 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -2421,7 +2421,8 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uInt8 nCount, NMode nMode )
     }
     const OString aScaleFactor(OString::number(nNumber));
     sal_uInt32 nLen = aScaleFactor.getLength();
-    long nStSize =  ( nCount + 1 ) - nLen;
+    sal_Int32 const nStSize = (nCount + 1) - nLen;
+    static_assert(sizeof(nStSize) == sizeof((nCount + 1) - nLen)); // tdf#134667
     if ( nStSize >= 1 )
     {
         mpPS->WriteUChar( '0' );
@@ -2430,7 +2431,7 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uInt8 nCount, NMode nMode )
     if ( nStSize >= 2 )
     {
         mpPS->WriteUChar( '.' );
-        for ( long i = 1; i < nStSize; i++ )
+        for (sal_Int32 i = 1; i < nStSize; ++i)
         {
             mpPS->WriteUChar( '0' );
             mnCursorPos++;


More information about the Libreoffice-commits mailing list