Commit 5a4904ce authored by Gildas Bazin's avatar Gildas Bazin

* src/input/input_ext-plugins.c: fixed nasty segfault when pf_read() returns -1;
parent aba56b6b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins * input_ext-plugins.c: useful functions for access and demux plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.35 2003/07/27 15:49:27 gbazin Exp $ * $Id: input_ext-plugins.c,v 1.36 2003/08/03 20:25:04 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -520,6 +520,10 @@ ssize_t input_FillBuffer( input_thread_t * p_input ) ...@@ -520,6 +520,10 @@ ssize_t input_FillBuffer( input_thread_t * p_input )
ReleaseBuffer( p_input->p_method_data, p_input->p_data_buffer ); ReleaseBuffer( p_input->p_method_data, p_input->p_data_buffer );
} }
p_input->p_data_buffer = p_buf;
p_input->p_current_data = (byte_t *)p_buf + sizeof(data_buffer_t);
p_input->p_last_data = p_input->p_current_data + i_remains;
/* Do not hold the lock during pf_read (blocking call). */ /* Do not hold the lock during pf_read (blocking call). */
vlc_mutex_unlock( &p_input->p_method_data->lock ); vlc_mutex_unlock( &p_input->p_method_data->lock );
...@@ -535,9 +539,7 @@ ssize_t input_FillBuffer( input_thread_t * p_input ) ...@@ -535,9 +539,7 @@ ssize_t input_FillBuffer( input_thread_t * p_input )
if( i_ret < 0 ) i_ret = 0; if( i_ret < 0 ) i_ret = 0;
p_input->p_data_buffer = p_buf; p_input->p_last_data += i_ret;
p_input->p_current_data = (byte_t *)p_buf + sizeof(data_buffer_t);
p_input->p_last_data = p_input->p_current_data + i_remains + i_ret;
return (ssize_t)i_remains + i_ret; return (ssize_t)i_remains + i_ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment