From f625ed681378c361ba51b9cf5b5906231de4acb3 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 3 Mar 2011 16:51:56 +0000 Subject: [PATCH 1/2] dbus_type_is_basic etc.: it is an error to pass in bad typecodes Previously, the comments said "this function will crash", but that's not strictly true (checks can be disabled or made non-fatal). Their behaviour is undefined if you do that, though. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=20496 --- dbus/dbus-signature.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dbus/dbus-signature.c b/dbus/dbus-signature.c index ddc0bcc..9c13ff4 100644 --- a/dbus/dbus-signature.c +++ b/dbus/dbus-signature.c @@ -283,9 +283,10 @@ dbus_signature_validate_single (const char *signature, * A "container type" can contain basic types, or nested * container types. #DBUS_TYPE_INVALID is not a container type. * - * This function will crash if passed a typecode that isn't - * in dbus-protocol.h + * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID, + * to this function. The valid type-codes are defined by dbus-protocol.h. * + * @param typecode either a valid type-code or DBUS_TYPE_INVALID * @returns #TRUE if type is a container */ dbus_bool_t @@ -305,9 +306,10 @@ dbus_type_is_container (int typecode) * variants are not basic types. #DBUS_TYPE_INVALID is not a basic * type. * - * This function will crash if passed a typecode that isn't - * in dbus-protocol.h + * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID, + * to this function. The valid type-codes are defined by dbus-protocol.h. * + * @param typecode either a valid type-code or DBUS_TYPE_INVALID * @returns #TRUE if type is basic */ dbus_bool_t @@ -334,9 +336,10 @@ dbus_type_is_basic (int typecode) * but struct is not considered a fixed type for purposes of this * function. * - * This function will crash if passed a typecode that isn't - * in dbus-protocol.h - * + * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID, + * to this function. The valid type-codes are defined by dbus-protocol.h. + * + * @param typecode either a valid type-code or DBUS_TYPE_INVALID * @returns #FALSE if the type can occupy different lengths */ dbus_bool_t -- 1.7.4.1