[vlc-devel] commit: Fix a stack smash in the lua module (vlc.read). (JP Dinger )

git version control git at videolan.org
Fri Jun 12 15:50:14 CEST 2009


vlc | branch: 1.0-bugfix | JP Dinger <jpd at videolan.org> | Fri Jun 12 15:05:56 2009 +0200| [c0b5cafa6d6667bb6aaeb37a82f3577d7f27ab97] | committer: JP Dinger 

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

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

 modules/misc/lua/demux.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/misc/lua/demux.c b/modules/misc/lua/demux.c
index 140afa9..d7f4445 100644
--- a/modules/misc/lua/demux.c
+++ b/modules/misc/lua/demux.c
@@ -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;
 }
 




More information about the vlc-devel mailing list