aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-01-31 14:27:49 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:21 +0200
commit2a2e6712ba03437857c1b39ed0ce1ca7b0974318 (patch)
tree7ca4bdca010c72250cdb244f21e3c7cbce123ef0 /gcc/rust
parent68d671ac725eb0937a892516906e300ad8a3c538 (diff)
downloadgcc-2a2e6712ba03437857c1b39ed0ce1ca7b0974318.zip
gcc-2a2e6712ba03437857c1b39ed0ce1ca7b0974318.tar.gz
gcc-2a2e6712ba03437857c1b39ed0ce1ca7b0974318.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/rust')
-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;