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 #11812 (Crash: misra addon, infinite recursion) #5207

Merged
merged 3 commits into from
Jul 4, 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
8 changes: 7 additions & 1 deletion addons/misra_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,13 @@ def createRecordChildrenDefs(ed, var):
valueType = ed.valueType
if not valueType or not valueType.typeScope:
return

typeToken = var.typeEndToken
while typeToken and typeToken.isName:
typeToken = typeToken.previous
if typeToken and typeToken.str == '*':
child = ElementDef("pointer", var.nameToken, var.nameToken.valueType)
ed.addChild(child)
return
for variable in valueType.typeScope.varlist:
if variable is var:
continue
Expand Down
30 changes: 30 additions & 0 deletions addons/test/misra/crash3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@




/* This is the representation of the expressions to determine the
plural form. */
struct expression
{
int nargs; /* Number of arguments. */
union
{
unsigned long int num; /* Number value for `num'. */
struct expression *args[3]; /* Up to three arguments. */
} val;
};


struct expression GERMANIC_PLURAL =
{
.nargs = 2,
.val =
{
.args =
{
[0] = (struct expression *) &plvar,
[1] = (struct expression *) &plone
}
}
};