From 8364ba3d386723332e43277cc2a4914a51517871 Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Thu, 5 Dec 2019 17:05:02 +0000 Subject: [PATCH] Make `Expr.getType()` robust against incomplete `type_of` table. --- ql/src/semmle/go/Expr.qll | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ql/src/semmle/go/Expr.qll b/ql/src/semmle/go/Expr.qll index 7b9d84f48e8..36729f67396 100644 --- a/ql/src/semmle/go/Expr.qll +++ b/ql/src/semmle/go/Expr.qll @@ -102,7 +102,12 @@ class Expr extends @expr, ExprParent { predicate isPlatformIndependentConstant() { none() } /** Gets the type of this expression. */ - Type getType() { type_of(this, result) } + Type getType() { + type_of(this, result) + or + not type_of(this, _) and + result instanceof InvalidType + } /** * Gets the global value number of this expression.