mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 23:38:10 +00: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:
parent
aa576e8fc0
commit
eb5571e57e
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user