[evolution-ews] Bug #675796 - Assertion abort in ews_decode_oab_prop()



commit 7ac1ec95685d28b9bd1c5279f79ea69246622459
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 28 13:23:12 2013 +0200

    Bug #675796 - Assertion abort in ews_decode_oab_prop()

 src/addressbook/ews-oab-decoder.c |   16 +++++++++++-----
 src/addressbook/ews-oab-props.h   |    1 +
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index c3e37b3..d9599a8 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -754,7 +754,7 @@ ews_decode_oab_prop (EwsOabDecoder *eod,
                        break;
                }
                default:
-                       g_assert_not_reached ();
+                       g_error ("%s: Cannot decode property 0x%x", G_STRFUNC, prop_id);
                        break;
        }
 
@@ -773,19 +773,19 @@ ews_destroy_oab_prop (guint32 prop_id, gpointer val)
                case EWS_PTYP_BOOLEAN:
                        break;
                case EWS_PTYP_BINARY:
-                       g_bytes_unref(val);
+                       g_bytes_unref (val);
                        break;
                case EWS_PTYP_STRING8:
                case EWS_PTYP_STRING:
                        g_free ((gchar *) val);
                        break;
                case EWS_PTYP_MULTIPLEBINARY:
-                       g_slist_foreach ((GSList *) val, (GFunc) g_bytes_unref, NULL);
-                       g_slist_free ((GSList *) val);
+                       g_slist_free_full ((GSList *) val, (GDestroyNotify) g_bytes_unref);
                        break;
                case EWS_PTYP_MULTIPLESTRING8:
                case EWS_PTYP_MULTIPLESTRING:
-                       g_slist_foreach ((GSList *) val, (GFunc) g_free, NULL);
+                       g_slist_free_full ((GSList *) val, g_free);
+                       break;
                case EWS_PTYP_MULTIPLEINTEGER32:
                        g_slist_free ((GSList *) val);
                        break;
@@ -917,6 +917,12 @@ ews_decode_addressbook_record (EwsOabDecoder *eod,
                val = g_slist_nth_data (props, i);
                prop_id = GPOINTER_TO_UINT (val);
 
+               /* these are not encoded in the OAB, according to
+                  http://msdn.microsoft.com/en-us/library/gg671985%28v=EXCHG.80%29.aspx
+                */
+               if ((prop_id & 0xFFFF) == EWS_PTYP_OBJECT)
+                       continue;
+
                val = ews_decode_oab_prop (eod, prop_id, cancellable, error);
 
                if (prop_id == EWS_PT_DISPLAY_TYPE)
diff --git a/src/addressbook/ews-oab-props.h b/src/addressbook/ews-oab-props.h
index a087c2a..2ec8047 100644
--- a/src/addressbook/ews-oab-props.h
+++ b/src/addressbook/ews-oab-props.h
@@ -25,6 +25,7 @@
 /* Ews oab data types */
 #define EWS_PTYP_INTEGER32             0x0003
 #define EWS_PTYP_BOOLEAN               0x000B
+#define        EWS_PTYP_OBJECT                 0x000d
 #define EWS_PTYP_STRING8               0x001E
 #define EWS_PTYP_STRING                        0x001F
 #define EWS_PTYP_BINARY                        0x0102


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]