[git] GpgOL - branch, STABLE-BRANCH-2-3, updated. gpgol-2.3.0-10-g907943a

by Andre Heinecke cvs at cvs.gnupg.org
Thu Sep 6 17:23:47 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, STABLE-BRANCH-2-3 has been updated
       via  907943aec81b5216ab678adf080e4656fcc5cd6a (commit)
       via  84fed74d4b44e177ae250aec9c49293481ddf5c0 (commit)
       via  fd901436fbf9f08630ee4e6ce38d1e7958ec1a6e (commit)
       via  8d140cb78c797c83ea882f34d11514cd8965386d (commit)
      from  7ac02373ee79b94f27d56573252947f1291a65a5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 907943aec81b5216ab678adf080e4656fcc5cd6a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 17:21:55 2018 +0200

    Try to fix crashes in MAPI SubmitMessage path
    
    * src/windowmessages.cpp (gpgol_window_proc): Close inspector
    before closing the mail.
    
    --
    This is purely experimental programming. The SubmitMessage paths
    both lead to random crashes. So I tried around what might
    be the cause and found this. Let's hope it is not just luck
    that it currently does not crash for me.
    
    GnuPG-Bug-Id: T4131

diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 25c5dcd..9991eba 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -133,6 +133,8 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                   break;
                 }
               mail->refCurrentItem();
+              Mail::closeInspector_o (mail);
+              TRACEPOINT;
               Mail::close (mail);
               log_debug ("%s:%s: Close finished.",
                          SRCNAME, __func__);

commit 84fed74d4b44e177ae250aec9c49293481ddf5c0
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 17:19:07 2018 +0200

    Add some safeguards against NULL base msg
    
    * src/common.h (ERR_GET_BASE_MSG_FAILED): Add new bug code.
    * src/mailitem-events.cpp (Send): Check for null base msg
    * src/windowmessages.cpp (gpgol_window_proc): ditto.
    * src/ribbon-callbacks.cpp (get_mail_from_control): ditto.
    
    --
    Except for get_mail_from_control this should never be hit
    (thus the bug error) but accessing a pointer before checking
    it seemed wrong.

diff --git a/src/common.h b/src/common.h
index 583a63a..0ed0d11 100644
--- a/src/common.h
+++ b/src/common.h
@@ -124,6 +124,7 @@ void i18n_init (void);
 #define ERR_INLINE_BODY_TO_BODY 4
 #define ERR_INLINE_BODY_INV_STATE 5
 #define ERR_SEND_FALLBACK_FAILED 6
+#define ERR_GET_BASE_MSG_FAILED 7
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 26cbbdd..1653565 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -518,17 +518,23 @@ EVENT_SINK_INVOKE(MailItemEvents)
                   log_debug ("%s:%s: Message %p - Activating T3656 Workaround",
                              SRCNAME, __func__, m_object);
                   message = get_oom_base_message (m_object);
-                  // It's important we use the _base_ message here.
-                  mapi_save_changes (message, KEEP_OPEN_READWRITE | FORCE_SAVE);
-                  message->SubmitMessage(0);
-                  gpgol_release (message);
-
+                  if (message)
+                    {
+                      // It's important we use the _base_ message here.
+                      mapi_save_changes (message, FORCE_SAVE);
+                      message->SubmitMessage(0);
+                      gpgol_release (message);
+                      // Close the composer and trigger unloads
+                      CloseHandle(CreateThread (NULL, 0, close_mail, (LPVOID) m_mail, 0,
+                                                NULL));
+                    }
+                  else
+                    {
+                      gpgol_bug (nullptr,
+                                 ERR_GET_BASE_MSG_FAILED);
+                    }
                   // Cancel send
                   *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE;
-
-                  // Close the composer and trigger unloads
-                  CloseHandle(CreateThread (NULL, 0, close_mail, (LPVOID) m_mail, 0,
-                                            NULL));
                 }
               MAPIFreeBuffer (propval);
               if (*(parms->rgvarg[0].pboolVal) == VARIANT_TRUE)
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index e9f8a5e..d7ea3c4 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -531,6 +531,13 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
   if (!uid)
     {
       LPMESSAGE msg = get_oom_base_message (mailitem);
+      if (!msg)
+        {
+          log_debug ("%s:%s: Failed to get message for %p",
+                   SRCNAME, __func__, mailitem);
+          gpgol_release (mailitem);
+          return NULL;
+        }
       uid = mapi_get_uid (msg);
       gpgol_release (msg);
       if (!uid)
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index ff8a1db..25c5dcd 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -169,9 +169,14 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                              "Trying SubmitMessage instead.",
                              SRCNAME, __func__, mail);
                   auto mail_message = get_oom_base_message (mail->item());
+                  if (!mail_message)
+                    {
+                      gpgol_bug (mail->getWindow (),
+                                 ERR_GET_BASE_MSG_FAILED);
+                      break;
+                    }
                   // It's important we use the _base_ message here.
-                  mapi_save_changes (mail_message,
-                                     KEEP_OPEN_READWRITE | FORCE_SAVE);
+                  mapi_save_changes (mail_message, FORCE_SAVE);
                   HRESULT hr = mail_message->SubmitMessage(0);
                   gpgol_release (mail_message);
 

commit fd901436fbf9f08630ee4e6ce38d1e7958ec1a6e
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 17:17:59 2018 +0200

    Fix minor mem leak in format error
    
    * src/parsecontroller.cpp (format_error): Don't leak
    the buf.

diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index 5a5d63d..df5b8fe 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -228,8 +228,9 @@ format_error(GpgME::DecryptionResult result, Protocol protocol)
                  SRCNAME, __func__);
       return "Failed to Format error.";
     }
-  memdbg_alloc (buf);
   msg = buf;
+  memdbg_alloc (buf);
+  xfree (buf);
   return msg;
 }
 

commit 8d140cb78c797c83ea882f34d11514cd8965386d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Sep 6 17:15:33 2018 +0200

    Do not release old ref in refCurrentItem
    
    * src/mail.cpp (Mail::refCurrentItem): Do not release
    existing ref.
    
    --
    This was stupid. Releasing the ref there could trigger
    the unload and so lead to crashes.
    
    Happliy the case that refCurrentItem was called multiple
    times did only exist for close and the anyway instable
    MAPI SubmitMessage codepath.

diff --git a/src/mail.cpp b/src/mail.cpp
index a3ec7ac..ba79e17 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -3486,7 +3486,9 @@ Mail::refCurrentItem()
 {
   if (m_currentItemRef)
     {
-      gpgol_release (m_currentItemRef);
+      log_debug ("%s:%s: Current item multi ref. Bug?",
+                 SRCNAME, __func__, count);
+      return;
     }
   /* This prevents a crash in Outlook 2013 when sending a mail as it
    * would unload too early.

-----------------------------------------------------------------------

Summary of changes:
 src/common.h             |  1 +
 src/mail.cpp             |  4 +++-
 src/mailitem-events.cpp  | 24 +++++++++++++++---------
 src/parsecontroller.cpp  |  3 ++-
 src/ribbon-callbacks.cpp |  7 +++++++
 src/windowmessages.cpp   | 11 +++++++++--
 6 files changed, 37 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list