Skip to content

Commit

Permalink
Merge topic 'release-str-oob' into release
Browse files Browse the repository at this point in the history
ccbda30 Fixed out of bounds string access found by ASan

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Reviewed-by: David Gobbi <[email protected]>
Merge-request: !11604
  • Loading branch information
dgobbi authored and kwrobot committed Oct 30, 2024
2 parents 9a518e2 + ccbda30 commit 8b39797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Wrapping/Tools/vtkParseMethodType.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int vtkParseMethodType_IsAsStringMethod(const char* name)
if (vtkParseMethodType_IsGetMethod(name))
{
n = strlen(name);
if (!strncmp(&name[n - 8], "AsString", 8))
if (n > 8 && !strncmp(&name[n - 8], "AsString", 8))
{
return 1;
}
Expand Down Expand Up @@ -133,7 +133,7 @@ int vtkParseMethodType_IsRemoveAllMethod(const char* name)
if (vtkParseMethodType_IsRemoveMethod(name))
{
n = strlen(name);
return (!strncmp(&name[6], "All", 3) && (n > 9) && isupper(name[9]));
return (n > 9) && isupper(name[9]) && !strncmp(&name[6], "All", 3);
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion Wrapping/Tools/vtkParseProperties.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int isAsStringMethod(const char* name)
if (isGetMethod(name))
{
n = strlen(name);
if (!strncmp(&name[n - 8], "AsString", 8))
if (n > 8 && !strncmp(&name[n - 8], "AsString", 8))
{
return 1;
}
Expand Down

0 comments on commit 8b39797

Please sign in to comment.