From 8f34de5c103e9e4d2c27583020f2975907b626ad Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Aug 2022 11:16:29 +0200 Subject: Manually check values for NULL when using low-level function interface --- libbuild2/cc/functions.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libbuild2/cc/functions.cxx') diff --git a/libbuild2/cc/functions.cxx b/libbuild2/cc/functions.cxx index bba8fbb..94900ee 100644 --- a/libbuild2/cc/functions.cxx +++ b/libbuild2/cc/functions.cxx @@ -61,6 +61,9 @@ namespace build2 // We can assume these are present due to function's types signature. // + if (vs[0].null) + throw invalid_argument ("null value"); + names& ts_ns (vs[0].as ()); // // In a somewhat hackish way strip the outer operation to match how we @@ -137,6 +140,9 @@ namespace build2 // We can assume this is present due to function's types signature. // + if (vs[0].null) + throw invalid_argument ("null value"); + names& ts_ns (vs[0].as ()); // optional li; @@ -369,6 +375,9 @@ namespace build2 bool rel (true); if (vs.size () > 2) { + if (vs[2].null) + throw invalid_argument ("null value"); + for (const name& f: vs[2].as ()) { string s (convert (name (f))); @@ -520,6 +529,9 @@ namespace build2 // We can assume the argument is present due to function's types // signature. // + if (vs[0].null) + throw invalid_argument ("null value"); + names& r (vs[0].as ()); m->deduplicate_export_libs (*bs, vector (r.begin (), r.end ()), -- cgit v1.1