summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Deps.pm
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2016-11-13 17:54:59 +0100
committerGuillem Jover <guillem@debian.org>2016-11-13 18:15:31 +0100
commitd3d4348c31418fd2a392e148a880dce7db283d20 (patch)
treeb1a606e222916af97f4fb5f71bf5c603d737d32c /scripts/Dpkg/Deps.pm
parent39545fbc7444e259d039fe39bd5345a2edaf8084 (diff)
downloaddpkg-d3d4348c31418fd2a392e148a880dce7db283d20.tar.gz
Dpkg::Deps: Validate architecture arguments in deps_parse()
This function only works with real and known Debian architectures. It will not work with wildcards, nor the special architectures 'all' nor 'source'. Validate the arguments and croak early on to spot bogus usage. Prompted-by: Johannes Schauer <josch@debian.org>
Diffstat (limited to 'scripts/Dpkg/Deps.pm')
-rw-r--r--scripts/Dpkg/Deps.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 33d44112f..e37e0392a 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -58,10 +58,11 @@ our @EXPORT = qw(
deps_compare
);
+use Carp;
use Exporter qw(import);
use Dpkg::Version;
-use Dpkg::Arch qw(get_host_arch get_build_arch);
+use Dpkg::Arch qw(get_host_arch get_build_arch debarch_to_debtuple);
use Dpkg::BuildProfiles qw(get_build_profiles);
use Dpkg::ErrorHandling;
use Dpkg::Gettext;
@@ -250,6 +251,12 @@ working with dependency fields from F<debian/tests/control>.
sub deps_parse {
my ($dep_line, %options) = @_;
+ # Validate arguments.
+ croak "invalid host_arch $options{host_arch}"
+ if defined $options{host_arch} and not defined debarch_to_debtuple($options{host_arch});
+ croak "invalid biuild_arch $options{build_arch}"
+ if defined $options{build_arch} and not defined debarch_to_debtuple($options{build_arch});
+
$options{use_arch} //= 1;
$options{reduce_arch} //= 0;
$options{host_arch} //= get_host_arch();