[PATCH] The problem is that the process handle is freed regardless o...

Christopher Copits (via Code Review) gerrit at gerrit.libreoffice.org
Tue Jan 1 13:39:13 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1530

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/30/1530/1

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
---
M basic/source/runtime/methods.cxx
1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 20fee90..1de512b 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3534,7 +3534,11 @@
                     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++)
         {

-- 
To view, visit https://gerrit.libreoffice.org/1530
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3af07be06e7af7730a3bcb1680c659a88b66af3
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christopher Copits <ChrisCDev at live.com>



More information about the LibreOffice mailing list