diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-01-04 10:34:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-01-04 10:34:26 +0200 |
commit | b1ef30736694f644e2e473429257a18b64a7615c (patch) | |
tree | f56a84ecc90cda0c43dccdf31b739d962d92334c | |
parent | 80c3fa5476bbdab479b57e892001b3259b5b3537 (diff) |
Fix few undefined behavior (ubsan) bugs
-rw-r--r-- | build2/cc/compile.cxx | 2 | ||||
-rw-r--r-- | build2/cc/windows-rpath.cxx | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 9de037e..47953ee 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -2973,7 +2973,7 @@ namespace build2 // if (cid == compiler_id::msvc && cmaj == 19 && cmin <= 11 && - src.is_a (*x_mod)) + x_mod != nullptr && src.is_a (*x_mod)) { // It's quite painful to guard the export with an #if/#endif so // if it is present, "fixup" the (temporary) preprocessed output diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx index 48e40bd..b28ce42 100644 --- a/build2/cc/windows-rpath.cxx +++ b/build2/cc/windows-rpath.cxx @@ -146,9 +146,10 @@ namespace build2 { // Get .pdb if there is one. // - const target* pdb ( - find_adhoc_member (*l, *bs.find_target_type ("pdb"))); - + const target_type* tt (bs.find_target_type ("pdb")); + const target* pdb (tt != nullptr + ? find_adhoc_member (*l, *tt) + : nullptr); r.insert ( windows_dll { f, |