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

git version control git at videolan.org
Thu Sep 10 11:08:36 CEST 2009


vlc | branch: 1.0-bugfix | Pierre Ynard <linkfanel at yahoo.fr> | Thu Sep 10 11:05:21 2009 +0200| [30a7e254595cd54064bd7de15b33c29f80ad0038] | committer: Pierre Ynard 

win32text: fix obvious null pointer dereference

This was totally broken over the last year
(cherry picked from commit 06bd41ad7f13cdb5535df1580c4891c3ad1b8066)

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

 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 4475a7a..8fa661a 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