aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-01-31 14:27:49 +0000
committerPhilip Herron <herron.philip@googlemail.com>2023-02-05 00:10:48 +0000
commite612713029296dac8429e4b00ec7659bcad5cffe (patch)
treef79c4b2e6632a091d2504310e0fcd7022944daa6 /gcc
parent95fa967f5c5ce9445fa3f08195c01138338fd0bd (diff)
downloadgcc-e612713029296dac8429e4b00ec7659bcad5cffe.zip
gcc-e612713029296dac8429e4b00ec7659bcad5cffe.tar.gz
gcc-e612713029296dac8429e4b00ec7659bcad5cffe.tar.bz2
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 <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionArg::is_conrete): fix check
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyty-subst.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc
index 7f5bb22..996bbf2 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;