[vlc-commits] commit: Expansion safety ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Mon Jul 19 19:00:08 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 19 19:57:30 2010 +0300| [f83fdcacb5f9fecf1ac457d6620eee1255748845] | committer: Rémi Denis-Courmont 

Expansion safety

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f83fdcacb5f9fecf1ac457d6620eee1255748845
---

 include/vlc_arrays.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
index 390c1b6..b8dbae4 100644
--- a/include/vlc_arrays.h
+++ b/include/vlc_arrays.h
@@ -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 )



More information about the vlc-commits mailing list