Skip to content

Commit

Permalink
Fix array subscript -1 is below array bounds of ‘const char *[31]’ [-…
Browse files Browse the repository at this point in the history
…Werror=array-bounds]
  • Loading branch information
jmarrec committed Nov 24, 2020
1 parent cb6c556 commit d53fb76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion third_party/FMI/xml_parser_cosim.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ static int checkElementType(void *element, Elm e)
static int checkPeek(int e)
{
if (stackIsEmpty(stack)) {
printf("Illegal document structure, expected %s\n", elmNames[e]);
if (e == ANY_TYPE) {
printf("Illegal document structure, expected ANY_TYPE (-1)\n");
} else {
printf("Illegal document structure, expected %s\n", elmNames[e]);
}
XML_StopParser(parser, XML_FALSE);
return 0; // error
}
Expand Down
6 changes: 5 additions & 1 deletion third_party/FMUParser/xml_parser_cosim.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ static int checkElementType(void *element, Elm e)
static int checkPeek(Elm e)
{
if (stackIsEmpty(stack)) {
printf("Illegal document structure, expected %s\n", elmNames[e]);
if (e == ANY_TYPE) {
printf("Illegal document structure, expected ANY_TYPE (-1)\n");
} else {
printf("Illegal document structure, expected %s\n", elmNames[e]);
}
XML_StopParser(parser, XML_FALSE);
return 0; // error
}
Expand Down

0 comments on commit d53fb76

Please sign in to comment.