diff options
author | fxxf <ff@fxxf.me> | 2022-06-16 20:54:58 +0300 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-06-16 21:15:27 -0400 |
commit | b7159f4a1a8901bfc4f1ecc7cff29b789c2101e9 (patch) | |
tree | e3c58a373017a63e7201d2dff46c6362ab16d23f /mesonbuild | |
parent | 2e3ac3eec00f32dabcfc470cd4c1090303d08e58 (diff) | |
download | meson-b7159f4a1a8901bfc4f1ecc7cff29b789c2101e9.zip meson-b7159f4a1a8901bfc4f1ecc7cff29b789c2101e9.tar.gz meson-b7159f4a1a8901bfc4f1ecc7cff29b789c2101e9.tar.bz2 |
fix crash when passing invalid inputs as build_target dependencies
The `add_deps` function did not behave correctly when a specified
dependency is not an instance of `dependencies.Dependency`.
Reorder the logic flow to perform this validation first.
Fixes #10468
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/build.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 233d953..ea9b2c2 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1343,12 +1343,6 @@ class BuildTarget(Target): if dep in self.added_deps: continue - dep_d_features = dep.d_features - - for feature in ('versions', 'import_dirs'): - if feature in dep_d_features: - self.d_features[feature].extend(dep_d_features[feature]) - if isinstance(dep, dependencies.InternalDependency): # Those parts that are internal. self.process_sourcelist(dep.sources) @@ -1387,6 +1381,13 @@ You probably should put it in link_with instead.''') 'either an external dependency (returned by find_library() or ' 'dependency()) or an internal dependency (returned by ' 'declare_dependency()).') + + dep_d_features = dep.d_features + + for feature in ('versions', 'import_dirs'): + if feature in dep_d_features: + self.d_features[feature].extend(dep_d_features[feature]) + self.added_deps.add(dep) def get_external_deps(self) -> T.List[dependencies.Dependency]: |