mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +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;
|
void *oldp = *array;
|
||||||
if (nelem & 31)
|
if (nelem & 31)
|
||||||
return;
|
return;
|
||||||
*array = realloc(*array, (nelem + 32) * elsize);
|
if (nelem > UINT_MAX / elsize - 32)
|
||||||
|
*array = NULL;
|
||||||
|
else
|
||||||
|
*array = realloc(*array, (nelem + 32) * elsize);
|
||||||
if (!*array)
|
if (!*array)
|
||||||
free(oldp);
|
free(oldp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user