[Libreoffice-commits] core.git: 3 commits - basic/qa basic/source javaunohelper/com sw/source

Caolán McNamara caolanm at redhat.com
Fri Jan 9 04:06:08 PST 2015


 basic/qa/vba_tests/replace.vb                         |    2 +-
 basic/source/runtime/methods.cxx                      |    4 ++--
 javaunohelper/com/sun/star/comp/helper/Bootstrap.java |    6 +++---
 sw/source/filter/ww8/ww8par.cxx                       |    7 ++++---
 4 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 201f99919253b370437d754137964d2757852079
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 9 11:30:00 2015 +0000

    asan: global-buffer-overflow on ooo12093-1.doc
    
    Change-Id: I5e29626fe2803d2751bdec9c6919662ea37cf64c

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b763ba5..d8421d2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5025,7 +5025,8 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
 
         aInfo.ePos = FTNPOS_PAGE;
         aInfo.eNum = eNumA[pWDop->rncFtn];
-        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[pWDop->nfcFtnRef]) );
+        sal_uInt16 nfcFtnRef = pWDop->nfcFtnRef & 0xF;
+        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[nfcFtnRef]) );
         if( pWDop->nFtn )
             aInfo.nFtnOffset = pWDop->nFtn - 1;
         rDoc.SetFtnInfo( aInfo );
@@ -5034,8 +5035,8 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
     {
         SwEndNoteInfo aInfo;
         aInfo = rDoc.GetEndNoteInfo(); // Same as for Ftn
-
-        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[pWDop->nfcEdnRef]) );
+        sal_uInt16 nfcEdnRef = pWDop->nfcEdnRef & 0xF;
+        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[nfcEdnRef]) );
         if( pWDop->nEdn )
             aInfo.nFtnOffset = pWDop->nEdn - 1;
         rDoc.SetEndNoteInfo( aInfo );
commit c23bed10cdb86a23aa70d1ea0484fe5bab639ea4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 9 11:04:27 2015 +0000

    fix indexes
    
    Change-Id: I99d3a715cce203eb2303c76da3b20e6d853a9d23

diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index f0145c6..6e677e6 100644
--- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
+++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
@@ -270,13 +270,13 @@ public class Bootstrap {
                 Long.toString( (new Random()).nextLong() & 0x7fffffffffffffffL );
 
             // create call with arguments
-            String[] cmdArray = new String[7];
+            String[] cmdArray = new String[6];
             cmdArray[0] = fOffice.getPath();
             cmdArray[1] = "--nologo";
             cmdArray[2] = "--nodefault";
             cmdArray[3] = "--norestore";
-            cmdArray[5] = "--nolockcheck";
-            cmdArray[6] = "--accept=pipe,name=" + sPipeName + ";urp;";
+            cmdArray[4] = "--nolockcheck";
+            cmdArray[5] = "--accept=pipe,name=" + sPipeName + ";urp;";
 
             // start office process
             Process p = Runtime.getRuntime().exec( cmdArray );
commit 476f75802a538fb3576cdac996fca6c348913d6f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 9 09:31:01 2015 +0000

    Resolves: #i94895# fix illegal result of Replace runtime function"
    
    and adjust the basic test-case, which is surely wrong
    
    The syntax for REPLACE is:
    
    // Replace(expression, find, replace[, start[, count[, compare]]])
    
    surely in the case of a start of 3 the preceeding chars should
    be returned unchanged in the result, not stripped off as before
    this change.
    
    This reverts commit 869402a58720b45e7227438b2e56e5a9532c0000.
    
    Change-Id: Ie710e4de9e7e35c84abe2770142a963532820af4

diff --git a/basic/qa/vba_tests/replace.vb b/basic/qa/vba_tests/replace.vb
index e04cde0..bd4817b 100644
--- a/basic/qa/vba_tests/replace.vb
+++ b/basic/qa/vba_tests/replace.vb
@@ -37,7 +37,7 @@ Function verify_testReplace() as String
     retStr = Replace(srcStr, destStr, repStr, compare:=vbTextCompare)
     TestLog_ASSERT retStr = "aefefdef", "text compare:" & retStr
     retStr = Replace(srcStr, destStr, repStr, 3, -1, vbBinaryCompare)
-    TestLog_ASSERT retStr = "cefdBc", "start = 3:" & retStr
+    TestLog_ASSERT retStr = "abcefdBc", "start = 3:" & retStr
     retStr = Replace(srcStr, destStr, repStr, 1, 2, vbBinaryCompare)
     TestLog_ASSERT retStr = "aefefdBc", "count = 2: " & retStr
     retStr = Replace(srcStr, destStr, repStr, 1, 0, vbBinaryCompare)
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 7ccbab7..baa9603 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1405,7 +1405,7 @@ RTLFUNC(Replace)
                 if( nPos >= 0 )
                 {
                     aExpStr = aExpStr.replaceAt( nPos, nFindStrLen, aReplaceStr );
-                    nPos = nPos - nFindStrLen + nReplaceStrLen + 1;
+                    nPos = nPos + nReplaceStrLen;
                     nCounts++;
                 }
                 else
@@ -1414,7 +1414,7 @@ RTLFUNC(Replace)
                 }
             }
         }
-        rPar.Get(0)->PutString( aExpStr.copy( lStartPos - 1 )  );
+        rPar.Get(0)->PutString( aExpStr  );
     }
 }
 


More information about the Libreoffice-commits mailing list