Fix segfault when doing lvalue check of buggy IEC 61131-3 source code
authormjsousa
Wed, 07 Aug 2013 10:24:32 +0100
changeset 828 a5f08df62002
parent 827 e3800aff352c
child 829 6e39eea5f5d0
Fix segfault when doing lvalue check of buggy IEC 61131-3 source code
stage3/lvalue_check.cc
--- a/stage3/lvalue_check.cc	Wed Aug 07 10:18:29 2013 +0100
+++ b/stage3/lvalue_check.cc	Wed Aug 07 10:24:32 2013 +0100
@@ -261,6 +261,12 @@
  */
 #include <string.h> /* required for strcmp() */
 void lvalue_check_c::check_nonformal_call(symbol_c *f_call, symbol_c *f_decl) {
+	/* if data type semantic verification was unable to determine which function is being called,
+	 * then it does not make sense to go ahead and check for lvalues to unknown parameters.
+	 * We simply bug out!
+	 */
+	if (NULL == f_decl) return;
+	
 	symbol_c *call_param_value;
 	identifier_c *param_name;
 	function_param_iterator_c       fp_iterator(f_decl);