Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 10855,11752:False positive: misra-c2012-22.10 #5557

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3849,8 +3849,8 @@ def misra_22_9(self, cfg):
def misra_22_10(self, cfg):
last_function_call = None
for token in cfg.tokenlist:
if token.str == '(' and not simpleMatch(token.link, ') {'):
name, args = cppcheckdata.get_function_call_name_args(token.previous)
if token.isName and token.next.str == '(' and not simpleMatch(token.next.link, ') {'):
name, args = cppcheckdata.get_function_call_name_args(token)
last_function_call = name
if token.str == '}':
last_function_call = None
Expand Down
9 changes: 9 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,4 +1929,13 @@ static void misra_22_10(void)
errno = 0;
f = strtod ( "A.12", NULL );
if ( 0 == errno ) {}

// #10855
f = strtol(numbuf, 0, (formatHex == 0U) ? 0 : 16);
if (errno != 0) {}

// #11752
#define NULL_PTR ((void*)0)
f = strtod(inStr, NULL_PTR);
if(errno != 0) {}
}
Loading