Commit c0b5cafa authored by JP Dinger's avatar JP Dinger

Fix a stack smash in the lua module (vlc.read).

parent ce0911fc
......@@ -28,6 +28,8 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_demux.h>
#include <vlc_url.h>
......@@ -72,10 +74,12 @@ static int vlclua_demux_peek( lua_State *L )
static int vlclua_demux_read( lua_State *L )
{
demux_t *p_demux = (demux_t *)vlclua_get_this( L );
uint8_t *p_read;
const uint8_t *p_read;
int n = luaL_checkint( L, 1 );
int i_read = stream_Read( p_demux->s, &p_read, n );
int i_read = stream_Peek( p_demux->s, &p_read, n );
lua_pushlstring( L, (const char *)p_read, i_read );
int i_seek = stream_Read( p_demux->s, NULL, i_read );
assert(i_read==i_seek);
return 1;
}
......
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