mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-24 20:48:52 +02:00
Expansion safety
This commit is contained in:
parent
a14e5a4edc
commit
f83fdcacb5
@ -48,7 +48,7 @@ static inline void *realloc_down( void *ptr, size_t size )
|
||||
#define INSERT_ELEM( p_ar, i_oldsize, i_pos, elem ) \
|
||||
do \
|
||||
{ \
|
||||
if( !i_oldsize ) (p_ar) = NULL; \
|
||||
if( !(i_oldsize) ) (p_ar) = NULL; \
|
||||
(p_ar) = VLCCVP realloc( p_ar, ((i_oldsize) + 1) * sizeof(*(p_ar)) ); \
|
||||
if( !(p_ar) ) abort(); \
|
||||
if( (i_oldsize) - (i_pos) ) \
|
||||
@ -56,7 +56,7 @@ static inline void *realloc_down( void *ptr, size_t size )
|
||||
memmove( (p_ar) + (i_pos) + 1, (p_ar) + (i_pos), \
|
||||
((i_oldsize) - (i_pos)) * sizeof( *(p_ar) ) ); \
|
||||
} \
|
||||
(p_ar)[i_pos] = elem; \
|
||||
(p_ar)[(i_pos)] = elem; \
|
||||
(i_oldsize)++; \
|
||||
} \
|
||||
while( 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user