[Libreoffice-commits] core.git: 2 commits - extras/CustomTarget_autocorr.mk extras/CustomTarget_autotextshare.mk extras/CustomTarget_autotextuser.mk sd/qa sd/source solenv/gbuild

Caolán McNamara caolanm at redhat.com
Fri Aug 28 02:29:32 PDT 2015


 extras/CustomTarget_autocorr.mk      |    2 +-
 extras/CustomTarget_autotextshare.mk |    2 +-
 extras/CustomTarget_autotextuser.mk  |    2 +-
 sd/qa/unit/data/ppt/pass/hang-18.ppt |binary
 sd/source/filter/ppt/propread.cxx    |   25 +++++++++++++++++++------
 solenv/gbuild/UIConfig.mk            |    2 +-
 solenv/gbuild/platform/macosx.mk     |    2 +-
 7 files changed, 24 insertions(+), 11 deletions(-)

New commits:
commit 580d3837b26f09ed02fe3583de40fa045a3fde0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 28 09:15:04 2015 +0100

    clip strings to max available size
    
    Change-Id: Icc1378c9c27b9b6d229bcffc6a63017f82be70d4

diff --git a/sd/qa/unit/data/ppt/pass/hang-18.ppt b/sd/qa/unit/data/ppt/pass/hang-18.ppt
new file mode 100644
index 0000000..3b3e9f7
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-18.ppt differ
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 86195be4..64e3725 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -73,7 +73,7 @@ static sal_Int32 lcl_getMaxSafeStrLen(sal_uInt32 nSize)
 
 bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
 {
-    sal_uInt32  i, nItemSize, nType, nItemPos;
+    sal_uInt32 nType, nItemPos;
     bool    bRetValue = false;
 
     nItemPos = Tell();
@@ -86,8 +86,8 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
     else
         nType = nStringType & VT_TYPEMASK;
 
-    nItemSize = 0; // Initialize in case stream fails.
-    ReadUInt32( nItemSize );
+    sal_uInt32 nItemSize(0); // Initialize in case stream fails.
+    ReadUInt32(nItemSize);
 
     switch( nType )
     {
@@ -95,6 +95,12 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
         {
             if ( nItemSize )
             {
+                auto nMaxSizePossible = remainingSize();
+                if (nItemSize > nMaxSizePossible)
+                {
+                    SAL_WARN("sd.filter", "String of Len " << nItemSize << " claimed, only " << nMaxSizePossible << " possible");
+                    nItemSize = nMaxSizePossible;
+                }
                 try
                 {
                     sal_Char* pString = new sal_Char[ nItemSize ];
@@ -104,7 +110,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
                         if ( nItemSize > 1 )
                         {
                             sal_Unicode* pWString = reinterpret_cast<sal_Unicode*>(pString);
-                            for ( i = 0; i < nItemSize; i++ )
+                            for (sal_uInt32 i = 0; i < nItemSize; ++i)
                                 ReadUInt16( pWString[ i ] );
                             rString = OUString(pWString, lcl_getMaxSafeStrLen(nItemSize));
                         }
@@ -140,12 +146,19 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
         {
             if ( nItemSize )
             {
+                auto nMaxSizePossible = remainingSize() / sizeof(sal_Unicode);
+                if (nItemSize > nMaxSizePossible)
+                {
+                    SAL_WARN("sd.filter", "String of Len " << nItemSize << " claimed, only " << nMaxSizePossible << " possible");
+                    nItemSize = nMaxSizePossible;
+                }
+
                 try
                 {
                     sal_Unicode* pString = new sal_Unicode[ nItemSize ];
-                    for ( i = 0; i < nItemSize; i++ )
+                    for (sal_uInt32 i = 0; i < nItemSize; ++i)
                         ReadUInt16( pString[ i ] );
-                    if ( pString[ i - 1 ] == 0 )
+                    if ( pString[ nItemSize - 1 ] == 0 )
                     {
                         if ( (sal_uInt16)nItemSize > 1 )
                             rString = OUString(pString, lcl_getMaxSafeStrLen(nItemSize));
commit fe1eb8809d22bc87d9d636f6c084ed5249c7eb37
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 28 09:56:12 2015 +0100

    use nonet for xsltproc
    
    Change-Id: I47f020722b46b727ad03a937f28f0b33033d61cb

diff --git a/extras/CustomTarget_autocorr.mk b/extras/CustomTarget_autocorr.mk
index b3c1ba5..9e5e9aa 100644
--- a/extras/CustomTarget_autocorr.mk
+++ b/extras/CustomTarget_autocorr.mk
@@ -257,7 +257,7 @@ $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype : $(SRCDIR
 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%.xml : $(SRCDIR)/extras/source/autocorr/lang/%.xml \
 		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$*.xml,$(true),XSL,1)
-	$(call gb_ExternalExecutable_get_command,xsltproc) -o $@ $(SRCDIR)/extras/util/compact.xsl $<
+	$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
 
 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%.dat :
 	$(call gb_Output_announce,$*.dat,$(true),ZIP,2)
diff --git a/extras/CustomTarget_autotextshare.mk b/extras/CustomTarget_autotextshare.mk
index 844ac43..486ac63 100644
--- a/extras/CustomTarget_autotextshare.mk
+++ b/extras/CustomTarget_autotextshare.mk
@@ -3843,7 +3843,7 @@ $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%.png : $(SRCDIR)/ext
 $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%.xml : $(SRCDIR)/extras/source/autotext/lang/%.xml \
 		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$*.xml,$(true),XSL,1)
-	$(call gb_ExternalExecutable_get_command,xsltproc) -o $@ $(SRCDIR)/extras/util/compact.xsl $<
+	$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
 
 $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%.bau :
 	$(call gb_Output_announce,$*.bau,$(true),ZIP,2)
diff --git a/extras/CustomTarget_autotextuser.mk b/extras/CustomTarget_autotextuser.mk
index 6b16149..fdbae43 100644
--- a/extras/CustomTarget_autotextuser.mk
+++ b/extras/CustomTarget_autotextuser.mk
@@ -36,7 +36,7 @@ $(call gb_CustomTarget_get_workdir,extras/source/autotext/user)/%/mimetype : $(S
 $(call gb_CustomTarget_get_workdir,extras/source/autotext/user)/%.xml : $(SRCDIR)/extras/source/autotext/%.xml \
 		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$*.xml,$(true),XSL,1)
-	$(call gb_ExternalExecutable_get_command,xsltproc) -o $@ $(SRCDIR)/extras/util/compact.xsl $<
+	$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
 
 $(call gb_CustomTarget_get_workdir,extras/source/autotext/user)/%.bau :
 	$(call gb_Output_announce,$*.bau,$(true),ZIP,2)
diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk
index 7746a5d..2e8e49c 100644
--- a/solenv/gbuild/UIConfig.mk
+++ b/solenv/gbuild/UIConfig.mk
@@ -123,7 +123,7 @@ gb_UIImageListTarget_XSLTFILE := $(SRCDIR)/solenv/bin/uiimagelist.xsl
 define gb_UIImageListTarget__command
 $(call gb_Output_announce,$(2),$(true),UIL,1)
 $(call gb_Helper_abbreviate_dirs,\
-	$(gb_UIImageListTarget_COMMAND) -o $@ $(gb_UIImageListTarget_XSLTFILE) $(UIFILE) && \
+	$(gb_UIImageListTarget_COMMAND) --nonet -o $@ $(gb_UIImageListTarget_XSLTFILE) $(UIFILE) && \
 	touch $@ \
 )
 endef
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 9b4f6a6..18d6996 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -355,7 +355,7 @@ endif
 
 define gb_UIMenubarTarget__command
 $(call gb_Output_announce,$(2),$(true),UIM,1)
-$(call gb_ExternalExecutable_get_command,xsltproc) -o $(1) $(UI_MENUBAR_XSLT) $(3)
+$(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $(1) $(UI_MENUBAR_XSLT) $(3)
 
 endef
 


More information about the Libreoffice-commits mailing list