mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
Check for integer overflow in grow_array.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29736 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
@@ -213,7 +213,10 @@ static void grow_array(void *arrayp, int nelem, size_t elsize) {
|
||||
void *oldp = *array;
|
||||
if (nelem & 31)
|
||||
return;
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
if (nelem > UINT_MAX / elsize - 32)
|
||||
*array = NULL;
|
||||
else
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
if (!*array)
|
||||
free(oldp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user