Fix possible but improbable overflow in hb_array_t

This commit is contained in:
Behdad Esfahbod 2011-04-28 12:58:28 -04:00
parent e0db4b868f
commit 123aa04f7b
1 changed files with 1 additions and 1 deletions

View File

@ -297,7 +297,7 @@ struct hb_static_array_t {
array = new_array;
}
} else {
bool overflows = new_allocated >= ((unsigned int) -1) / sizeof (Type);
bool overflows = (new_allocated < allocated) || (new_allocated >= ((unsigned int) -1) / sizeof (Type));
if (unlikely (overflows))
new_array = NULL;
else