[vlc-devel] commit: Fix a segfault : check the return value of x264_encoder_open(). ( Adrien Maglo )

git version control git at videolan.org
Fri May 29 08:13:34 CEST 2009


vlc | branch: 1.0-bugfix | Adrien Maglo <magsoft at videolan.org> | Thu May 28 20:05:23 2009 +0200| [77dea4efed8f1ce11edf551ac33b53ead9fb16a8] | committer: Jean-Baptiste Kempf 

Fix a segfault : check the return value of x264_encoder_open().

According to x264 code, if it fails, it return NULL.
And with a first NULL parameter x264_encoder_headers() segfaults.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 5004c2c..abda424 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -1304,6 +1304,12 @@ static int  Open ( vlc_object_t *p_this )
     /* Open the encoder */
     p_sys->h = x264_encoder_open( &p_sys->param );
 
+    if( p_sys->h == NULL )
+    {
+        msg_Err( p_enc, "cannot open x264 encoder" );
+        return VLC_EGENERIC;
+    }
+
     /* alloc mem */
     p_sys->i_buffer = 4 * p_enc->fmt_in.video.i_width *
         p_enc->fmt_in.video.i_height + 1000;




More information about the vlc-devel mailing list