From d588ee375b8ed51e514107f028ddd28f38915b98 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Wed, 30 Nov 2022 15:55:04 +0000 Subject: [PATCH] Fix `mayHaveSideEffects` for `ReturnStmt` The previous code only worked when the return statement only has one returned expression. --- go/ql/lib/semmle/go/Stmt.qll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/ql/lib/semmle/go/Stmt.qll b/go/ql/lib/semmle/go/Stmt.qll index 9873bf1db17..2a77450855d 100644 --- a/go/ql/lib/semmle/go/Stmt.qll +++ b/go/ql/lib/semmle/go/Stmt.qll @@ -569,7 +569,7 @@ class ReturnStmt extends @returnstmt, Stmt { /** Gets the unique returned expression, if there is only one. */ Expr getExpr() { getNumChild() = 1 and result = getExpr(0) } - override predicate mayHaveSideEffects() { getExpr().mayHaveSideEffects() } + override predicate mayHaveSideEffects() { getAnExpr().mayHaveSideEffects() } override string toString() { result = "return statement" }