Skip to content

Ghidra is a software reverse engineering (SRE) framework

Better parse checking on "funcall" rule.

caheckman410b92c61140
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SleighCompiler.g b/Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SleighCompiler.g
index f10c5e833c..8d05e777d0 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SleighCompiler.g
+++ b/Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SleighCompiler.g
@@ -1246,7 +1246,17 @@ funcall returns [VectorSTL<OpTpl> value]
@init {
$Return::noReturn = true;
}
- : e=expr_apply { $value = (VectorSTL<OpTpl>) e; }
+ : e=expr_apply {
+ if (e instanceof VectorSTL<?>)
+ $value = (VectorSTL<OpTpl>) e;
+ else {
+ Location loc = null;
+ if (e instanceof ExprTree) {
+ loc = ((ExprTree)e).location;
+ }
+ reportError(loc,"Functional operator requires a return value");
+ }
+ }
;
build_stmt returns [VectorSTL<OpTpl> ops]