From c1f0e189030ceb2bafea0bc30d6b72a0fa381ddc Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 10 Oct 2003 03:56:30 +0000 Subject: 2003-10-09 Havoc Pennington * configure.in: define DBUS_HAVE_GCC33_GCOV if we have gcc 3.3. Not that we do anything about it yet. * bus/signals.c (bus_match_rule_parse): impose max length on the match rule text * dbus/dbus-protocol.h: add DBUS_MAXIMUM_MATCH_RULE_LENGTH --- ChangeLog | 10 ++++++++++ bus/signals.c | 9 +++++++++ configure.in | 9 +++++++++ dbus/dbus-protocol.h | 3 +++ test/decode-gcov.c | 4 ++++ 5 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 920c23f4..a64b55ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-10-09 Havoc Pennington + + * configure.in: define DBUS_HAVE_GCC33_GCOV if we have + gcc 3.3. Not that we do anything about it yet. + + * bus/signals.c (bus_match_rule_parse): impose max length on the + match rule text + + * dbus/dbus-protocol.h: add DBUS_MAXIMUM_MATCH_RULE_LENGTH + 2003-10-09 Havoc Pennington Make matching rules theoretically work (add parser). diff --git a/bus/signals.c b/bus/signals.c index 960d846c..0fd4b514 100644 --- a/bus/signals.c +++ b/bus/signals.c @@ -586,6 +586,15 @@ bus_match_rule_parse (DBusConnection *matches_go_to, int i; _DBUS_ASSERT_ERROR_IS_CLEAR (error); + + if (_dbus_string_get_length (rule_text) > DBUS_MAXIMUM_MATCH_RULE_LENGTH) + { + dbus_set_error (error, DBUS_ERROR_LIMITS_EXCEEDED, + "Match rule text is %d bytes, maximum is %d", + _dbus_string_get_length (rule_text), + DBUS_MAXIMUM_MATCH_RULE_LENGTH); + return NULL; + } memset (tokens, '\0', sizeof (tokens)); diff --git a/configure.in b/configure.in index 8a2c7aad..e128fddf 100644 --- a/configure.in +++ b/configure.in @@ -223,6 +223,15 @@ changequote([,])dnl if test x$enable_gcov = xyes; then ## so that config.h changes when you toggle gcov support AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing]) + + AC_MSG_CHECKING([for gcc 3.3 version of gcov file format]) + have_gcc33_gcov=no + AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])], + have_gcc33_gcov=yes) + if test x$have_gcc33_gcov = xyes ; then + AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format]) + fi + AC_MSG_RESULT($have_gcc33_gcov) fi AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes) diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index a0cf54ef..549ef0e5 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -60,6 +60,9 @@ extern "C" { /* Max length in bytes of a service or interface or member name */ #define DBUS_MAXIMUM_NAME_LENGTH 256 +/* Max length of a match rule string */ +#define DBUS_MAXIMUM_MATCH_RULE_LENGTH 1024 + /* Types of message */ #define DBUS_MESSAGE_TYPE_INVALID 0 #define DBUS_MESSAGE_TYPE_METHOD_CALL 1 diff --git a/test/decode-gcov.c b/test/decode-gcov.c index a7a4478b..29f061f7 100644 --- a/test/decode-gcov.c +++ b/test/decode-gcov.c @@ -38,6 +38,10 @@ #include #include +#ifdef DBUS_HAVE_GCC33_GCOV +#error "gcov support not yet implemented for gcc 3.3 and greater; the file format changed" +#endif + #ifndef DBUS_HAVE_INT64 #error "gcov support can't be built without 64-bit integer support" #endif -- cgit