[DRE-maint] Bug#456562: libdbus-ruby: packet header and variant signature handling are broken

Drake Wilson drake at begriffli.ch
Sun Dec 16 16:23:14 UTC 2007


Package: libdbus-ruby
Version: 0.2.0-1
Severity: normal
Tags: patch

In dbus/message.rb, the MESSAGE_SIGNATURE constant, determining the
signature of a message header, is defined as "yyyyuua(yyv)".  There is
an extra "y" element in the final array.  According to the D-Bus
specification[1], version 0.12, the correct signature is
"yyyyuua(yv)".

This is coupled with a bug in the variant parsing that counteracts the
former bug for message headers only, while breaking parsing of
variants in every other case.  For variants, the length byte is
erroneously treated as part of the type signature string; the
MESSAGE_SIGNATURE for headers is off by one byte in the other
direction, which makes the byte get skipped and thrown away anyway,
but trying to parse other variants chokes horribly.

A patch is attached that appears to fix this.

[1] http://dbus.freedesktop.org/doc/dbus-specification.html

   ---> Drake Wilson

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22.2 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libdbus-ruby depends on:
ii  libdbus-ruby1.8               0.2.0-1    Ruby 1.8 binding for D-Bus

libdbus-ruby recommends no packages.

-- no debconf information
-------------- next part --------------
diff -ur libdbus-ruby-0.2.0/lib/dbus/marshall.rb libdbus-ruby-new/lib/dbus/marshall.rb
--- libdbus-ruby-0.2.0/lib/dbus/marshall.rb	2007-05-26 06:43:50.000000000 -0500
+++ libdbus-ruby-new/lib/dbus/marshall.rb	2007-12-16 10:11:19.000000000 -0600
@@ -202,7 +202,7 @@
           packet << do_parse(elem)
         end
       when Type::VARIANT
-        string = get_nul_terminated
+        string = get_signature
         # error checking please
         sig = Type::Parser.new(string).parse[0]
         packet = do_parse(sig)
diff -ur libdbus-ruby-0.2.0/lib/dbus/message.rb libdbus-ruby-new/lib/dbus/message.rb
--- libdbus-ruby-0.2.0/lib/dbus/message.rb	2007-04-25 16:29:26.000000000 -0500
+++ libdbus-ruby-new/lib/dbus/message.rb	2007-12-16 10:06:43.000000000 -0600
@@ -21,7 +21,7 @@
     # Mutex that protects updates on the serial number.
     @@serial_mutex = Mutex.new
     # Type of a message (by specification).
-    MESSAGE_SIGNATURE = "yyyyuua(yyv)"
+    MESSAGE_SIGNATURE = "yyyyuua(yv)"
 
     # FIXME: following message type constants should be under Message::Type IMO
     # well, yeah sure
@@ -220,21 +220,21 @@
       headers.each do |struct|
         case struct[0]
         when PATH
-          @path = struct[2]
+          @path = struct[1]
         when INTERFACE
-          @interface = struct[2]
+          @interface = struct[1]
         when MEMBER
-          @member = struct[2]
+          @member = struct[1]
         when ERROR_NAME
-          @error_name = struct[2]
+          @error_name = struct[1]
         when REPLY_SERIAL
-          @reply_serial = struct[2]
+          @reply_serial = struct[1]
         when DESTINATION
-          @destination = struct[2]
+          @destination = struct[1]
         when SENDER
-          @sender = struct[2]
+          @sender = struct[1]
         when SIGNATURE
-          @signature = struct[2]
+          @signature = struct[1]
         end
       end
       pu.align(8)


More information about the Pkg-ruby-extras-maintainers mailing list