From: Philip Herron Date: Tue, 31 Jan 2023 14:27:49 +0000 (+0000) Subject: gccrs: Fix nullptr dereference X-Git-Tag: basepoints/gcc-14~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a2e6712ba03437857c1b39ed0ce1ca7b0974318;p=thirdparty%2Fgcc.git gccrs: Fix nullptr dereference When we check if this is concrete the guard checks to ensure the argument is non null but the check here is wrongly returning early when the check is non null meaning when it is null and therefore not concrete it will end up doing a null dereference. Signed-off-by: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionArg::is_conrete): fix check --- diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc index 7f5bb22687d5..996bbf2d8857 100644 --- a/gcc/rust/typecheck/rust-tyty-subst.cc +++ b/gcc/rust/typecheck/rust-tyty-subst.cc @@ -213,8 +213,8 @@ SubstitutionArg::is_error () const bool SubstitutionArg::is_conrete () const { - if (argument != nullptr) - return true; + if (argument == nullptr) + return false; if (argument->get_kind () == TyTy::TypeKind::PARAM) return false;