[Pkg-utopia-maintainers] Bug#541632: [PATCH] dbus-gvalue: set an error when demarshal_basic doesn't recognize type

Andres Salomon dilinger at collabora.co.uk
Fri Aug 21 22:39:46 UTC 2009


In case this gets lost upstream, please consider adding this to the
debian package.  This is what I ended up sending upstream.






By passing dbus_g_proxy_call an incorrect signature, we can cause
the function to fail but not provide any error message (if
G_DISABLE_ASSERT is defined).  As smvc pointed out, this can also
become a runtime error when a telepathy CM changes signature, but
the client hasn't been updated.  As such, g_assert isn't an appropriate
action.  See http://bugs.debian.org/541632 for more information.

This patch causes it to set an error when demarshalling a type that it's
not expecting.  Instead of a NULL error, one instead
sees something like the following when the method returns a path
object but the client expected a string:

"modem Create() failed: Expected type gchararray, got type code 'o'"

Signed-off-by: Andres Salomon <dilinger at collabora.co.uk>
---
 dbus/dbus-gvalue.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/dbus/dbus-gvalue.c b/dbus/dbus-gvalue.c
index 49ae16e..6ba3663 100644
--- a/dbus/dbus-gvalue.c
+++ b/dbus/dbus-gvalue.c
@@ -585,8 +585,7 @@ demarshal_basic (DBusGValueMarshalCtx      *context,
 	return TRUE;
       }
     default:
-      g_assert_not_reached ();
-      return FALSE;
+      /* fall through to invalid_type */
     }
   invalid_type:
     g_set_error (error,
-- 
1.6.3.3






More information about the Pkg-utopia-maintainers mailing list