mirror of https://github.com/GNOME/gimp.git
script-fu: fix out-of-bounds array access
I noticed this in coverity. I couldn't find any actual script using SF_DISPLAY, so the impact probably isn't very big. Because the enums start at 0, the size of the array should be at least one more than the value of the last enum, which was not the case here. Increase the size of the array by 1, so that accessing SF_DISPLAY, which is the enum with the highest value, is valid.
This commit is contained in:
parent
624ae512fc
commit
6484193d8f
|
@ -731,12 +731,12 @@ script_fu_arg_append_repr_from_self (SFArg *arg,
|
|||
/* Array the size of the enum
|
||||
* Counts names generated per SF type per generator session.
|
||||
*/
|
||||
static gint arg_count[SF_DISPLAY] = { 0, };
|
||||
static gint arg_count[SF_DISPLAY + 1] = { 0, };
|
||||
|
||||
void
|
||||
script_fu_arg_reset_name_generator (void)
|
||||
{
|
||||
for (guint i = 0; i<SF_DISPLAY; i++)
|
||||
for (guint i = 0; i <= SF_DISPLAY; i++)
|
||||
arg_count[i] = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue