From 8d743ac19a1b0c15deccfb14525eaeef56b4135b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 2 Jan 2018 14:28:10 +0200 Subject: Fix few undefined behavior (ubsan) bugs --- build2/install/functions.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'build2/install') diff --git a/build2/install/functions.cxx b/build2/install/functions.cxx index b9298b2..dbe43c8 100644 --- a/build2/install/functions.cxx +++ b/build2/install/functions.cxx @@ -21,7 +21,13 @@ namespace build2 // Resolve potentially relative install.* value to an absolute directory // based on (other) install.* values visible from the calling scope. // - f["resolve"] = &resolve_dir; + f[".resolve"] = [] (const scope* s, dir_path d) + { + if (s == nullptr) + fail << "install.resolve() called out of scope" << endf; + + return resolve_dir (*s, move (d)); + }; } } } -- cgit v1.1