[Libreoffice-commits] .: basic/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 7 05:58:43 PST 2013


 basic/source/runtime/methods.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit dbfc8777bf73872d1b96f956b9e778d9099d52b3
Author: Christopher Copits <ChrisCDev at live.com>
Date:   Tue Jan 1 16:29:32 2013 -0500

    fdo#53521 Crash when running BASIC's "shell()" with a non-existent program
    
    The problem is that the process handle is freed regardless of whether osl_executeProcess was successful or not. Therefore, a segmentation fault would result, as a random memory address would be freed. This patch checks whether osl_executeProcess was successful. If it was, then it frees the handle; if it wasn't successful, the memory is not freed.
    
    Change-Id: Ic3af07be06e7af7730a3bcb1680c659a88b66af3
    Reviewed-on: https://gerrit.libreoffice.org/1530
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 45e59a6..3a6eb97 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3534,7 +3534,11 @@ RTLFUNC(Shell)
                     NULL, 0,
                     &pApp ) == osl_Process_E_None;
 
-        osl_freeProcessHandle( pApp );
+        // 53521 only free process handle on success
+        if (bSucc)
+        {
+            osl_freeProcessHandle( pApp );
+        }
 
         for(int j = 0; i < nParamCount; i++)
         {


More information about the Libreoffice-commits mailing list