[vlc-commits] transcode: fix null-deref in some error cases

Thomas Guillem git at videolan.org
Fri Jan 19 12:01:43 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 19 08:30:30 2018 +0100| [9354540af61c800bb9e2eec8307733cbb2064e8a] | committer: Jean-Baptiste Kempf

transcode: fix null-deref in some error cases

Null-deref could happen when flushing (p_buffer == NULL).

(cherry picked from commit 969da8f53d05a45b7b064e8530c648dbd565ab51)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_out/transcode/transcode.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index 99784a3f99..3420db2369 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -587,9 +587,8 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     {
         if( id->id )
             return sout_StreamIdSend( p_stream->p_next, id->id, p_buffer );
-
-        block_Release( p_buffer );
-        return VLC_EGENERIC;
+        else
+            goto error;
     }
 
     switch( id->p_decoder->fmt_in.i_cat )
@@ -619,12 +618,14 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         break;
 
     default:
-        p_out = NULL;
-        block_Release( p_buffer );
-        break;
+        goto error;
     }
 
     if( p_out )
         return sout_StreamIdSend( p_stream->p_next, id->id, p_out );
     return VLC_SUCCESS;
+error:
+    if( p_buffer )
+        block_Release( p_buffer );
+    return VLC_EGENERIC;
 }



More information about the vlc-commits mailing list