[vlc-commits] picture: handle allocation of pictures with 0 bytes-per-pixel

Rémi Denis-Courmont git at videolan.org
Sun Jul 7 20:13:37 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 18 00:07:24 2013 +0300| [5f507b68fe4011e135fd25c1361153537968746a] | committer: Rémi Denis-Courmont

picture: handle allocation of pictures with 0 bytes-per-pixel

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

 src/misc/picture.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/misc/picture.c b/src/misc/picture.c
index 60b8821..ee30af0 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -54,7 +54,7 @@ static int AllocatePicture( picture_t *p_pic )
     {
         const plane_t *p = &p_pic->p[i];
 
-        if( p->i_pitch <= 0 || p->i_lines <= 0 ||
+        if( p->i_pitch < 0 || p->i_lines <= 0 ||
             (size_t)p->i_pitch > (SIZE_MAX - i_bytes)/p->i_lines )
         {
             p_pic->i_planes = 0;
@@ -64,7 +64,7 @@ static int AllocatePicture( picture_t *p_pic )
     }
 
     uint8_t *p_data = vlc_memalign( 16, i_bytes );
-    if( !p_data )
+    if( i_bytes > 0 && p_data == NULL )
     {
         p_pic->i_planes = 0;
         return VLC_EGENERIC;



More information about the vlc-commits mailing list