[PATCH] do not call _dbus_warn_check_failed on checks

Matthew Johnson dbus at matthew.ath.cx
Tue Nov 14 10:05:13 PST 2006


On Tue, 14 Nov 2006, Daniel Stone wrote:

> The D-Bus use in the X server is currently limited to dealing with
> requests to add and remove input devices.  Right now, passing in
> something which triggers a D-Bus check results in abort() being
> triggered for the _entire server_.

You could just validate the args before using them, there are even
functions to do so now. A quick grep of the source shows that if you:

    - don't pass null to anything
    - pass in a valid bus type (range is defined in the headers, probably
      statically defined in your program)
    - set the message type to something valid (ditto)
    - don't set the timeout to 0
    - don't send messages with no body
    - don't try and iterate on iterators which haven't been initialised
    - don't try and write to read iterators
    - match _ref and _unref calls
    - pass in valid bus names/paths/members (there are convenience
      functions to check, and it's in the spec)
    - don't try and add an argument with an invalid type (range is
      defined in the headers, probably statically defined in your program)
    - don't try and _close() shared connections

then you will never have a check fail. Do you really think that you
can't enforce the above things on your code?

IMHO, this is one of the things which high-level libraries check as a
convenience for you (Java does), but you are on your own if you use the
low-level one.

Matt
-- 
Matthew Johnson
http://www.matthew.ath.cx/


More information about the dbus mailing list