[vlc-devel] commit: win32text: fix obvious null pointer dereference (Pierre Ynard )

git version control git at videolan.org
Thu Sep 10 11:07:09 CEST 2009


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Sep 10 11:05:21 2009 +0200| [06bd41ad7f13cdb5535df1580c4891c3ad1b8066] | committer: Pierre Ynard 

win32text: fix obvious null pointer dereference

This was totally broken over the last year

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

 modules/misc/win32text.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/misc/win32text.c b/modules/misc/win32text.c
index b48f856..9d0a0db 100644
--- a/modules/misc/win32text.c
+++ b/modules/misc/win32text.c
@@ -227,6 +227,9 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
     fmt.i_x_offset = fmt.i_y_offset = 0;
 
     /* Build palette */
+    fmt.p_palette = calloc( 1, sizeof(*fmt.p_palette) );
+    if( !fmt.p_palette )
+        return VLC_EGENERIC;
     fmt.p_palette->i_entries = 16;
     for( i = 0; i < fmt.p_palette->i_entries; i++ )
     {
@@ -238,7 +241,10 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
 
     p_region->p_picture = picture_New( fmt.i_chroma, fmt.i_width, fmt.i_height, fmt.i_aspect );
     if( !p_region->p_picture )
+    {
+        free( fmt.p_palette );
         return VLC_EGENERIC;
+    }
     p_region->fmt = fmt;
 
     p_dst = p_region->p_picture->Y_PIXELS;




More information about the vlc-devel mailing list