From b444c002e25a92e5afc62081502bd914804e6269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 3 May 2022 22:03:24 +0200 Subject: [PATCH] Fixed #11000 (misra: crash) --- addons/misra.py | 2 +- addons/test/misra/misra-test.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/misra.py b/addons/misra.py index 2a7ab303f..2c266e5ba 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1837,7 +1837,7 @@ class MisraChecker: usedParameter = parametersUsed[i] parameterDefinition = functionDeclaration.argument.get(i+1) - if usedParameter.isString and parameterDefinition.nameToken: + if usedParameter.isString and parameterDefinition and parameterDefinition.nameToken: reportErrorIfVariableIsNotConst(parameterDefinition.nameToken, usedParameter) def misra_8_1(self, cfg): diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 78f283136..1b6389ecd 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -315,6 +315,7 @@ static const char *misra_7_4_return_const (void) { return 1 + "return_const"; } static void misra_7_4_const_call(int a, const char* b) { } // 2.7 static void misra_7_4_const_ptr_call(int a, const char const* b) { } // 2.7 static void misra_7_4_call(int a, char* b) { } // 2.7 +static void misra_7_4_call_2(int a, ...) { } // 2.7 static void misra_7_4(void) { @@ -330,6 +331,7 @@ static void misra_7_4(void) misra_7_4_const_call(1, ("text_const_call")); misra_7_4_const_ptr_call(1, ("text_const_call")); misra_7_4_call(1, "text_call"); // 7.4 11.8 + misra_7_4_call_2(1, "a", "b"); } const misra_8_1_a; // 8.1 8.4