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

misra: Fix crash in misra_9.py when struct type is unknown and there is string initialization #5233

Merged
merged 1 commit into from
Jul 11, 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
2 changes: 1 addition & 1 deletion addons/misra_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def parseInitializer(self, root, token):
isFirstElement = False
isDesignated = True

elif self.token.isString and self.ed.isArray:
elif self.token.isString and self.ed and self.ed.isArray:
self.ed.setInitialized(isDesignated)
if self.token == self.token.astParent.astOperand1 and self.token.astParent.astOperand2:
self.token = self.token.astParent.astOperand2
Expand Down
8 changes: 8 additions & 0 deletions addons/test/misra/crash7.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


static const struct id3_frametype wordlist[] =
{
{0, "Encryption method registration"},
{1, "Popularimeter"},
};