[libnet-dbus-perl] 315/335: Fix decoding of type signatures with nested arrays
Intrigeri
intrigeri at moszumanska.debian.org
Sat Mar 21 01:08:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.
commit 407b780bd63b3796034135c9c9ad3ccb17207386
Author: Daniel Collins <daniel.collins at smoothwall.net>
Date: Tue Mar 11 10:29:50 2014 +0000
Fix decoding of type signatures with nested arrays
Net::DBus incorrectly parses type signatures containing nested arrays
and throws an exception when loading the introspection data from an
object which has such a structure inside a dict.
---
lib/Net/DBus/Binding/Introspector.pm | 8 ++++----
t/40-introspector.t | 10 ++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/Net/DBus/Binding/Introspector.pm b/lib/Net/DBus/Binding/Introspector.pm
index e286c67..b5bc305 100644
--- a/lib/Net/DBus/Binding/Introspector.pm
+++ b/lib/Net/DBus/Binding/Introspector.pm
@@ -770,7 +770,7 @@ sub _parse_type {
while (my $type = shift @{$sig}) {
if (exists $simple_type_rev_map{ord($type)}) {
push @{$current}, $simple_type_rev_map{ord($type)};
- if ($current->[0] eq "array") {
+ while ($current->[0] eq "array") {
$current = pop @cont;
}
} else {
@@ -793,19 +793,19 @@ sub _parse_type {
die "unexpected end of struct" unless
$current->[0] eq "struct";
$current = pop @cont;
- if ($current->[0] eq "array") {
+ while ($current->[0] eq "array") {
$current = pop @cont;
}
} elsif ($type eq "}") {
die "unexpected end of dict" unless
$current->[0] eq "dict";
$current = pop @cont;
- if ($current->[0] eq "array") {
+ while ($current->[0] eq "array") {
$current = pop @cont;
}
} elsif ($type eq "v") {
push @{$current}, ["variant"];
- if ($current->[0] eq "array") {
+ while ($current->[0] eq "array") {
$current = pop @cont;
}
} else {
diff --git a/t/40-introspector.t b/t/40-introspector.t
index dd88baa..d0515e5 100644
--- a/t/40-introspector.t
+++ b/t/40-introspector.t
@@ -27,6 +27,10 @@ TEST_ONE: {
paramnames => ["ooh"],
returnnames => ["ahh", "eek"],
},
+ "nested" => {
+ params => [["dict", "string", ["array", ["array", "string"]]]],
+ returns => [],
+ },
},
signals => {
"meltdown" => {
@@ -62,6 +66,9 @@ TEST_ONE: {
<arg type="(iy)" direction="in"/>
<arg name="frob" type="i" direction="out"/>
</method>
+ <method name="nested">
+ <arg type="a{saas}" direction="in"/>
+ </method>
<signal name="meltdown">
<arg type="i"/>
<arg type="y"/>
@@ -167,6 +174,9 @@ EOF
<arg type="(iy)" direction="in"/>
<arg name="frob" type="i" direction="out"/>
</method>
+ <method name="nested">
+ <arg type="a{saas}" direction="in"/>
+ </method>
<signal name="meltdown">
<arg type="i"/>
<arg type="y"/>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git
More information about the Pkg-perl-cvs-commits
mailing list