Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
8f048e9c
Commit
8f048e9c
authored
May 23, 2012
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: fix more sd input options and lua stack use-after-gc
Strings from the lua stack stop being valid after you pop them
parent
7211f9c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
modules/lua/libs/sd.c
modules/lua/libs/sd.c
+17
-8
No files found.
modules/lua/libs/sd.c
View file @
8f048e9c
...
...
@@ -220,19 +220,23 @@ static int vlclua_sd_add_item( lua_State *L )
lua_getfield
(
L
,
-
1
,
"path"
);
if
(
lua_isstring
(
L
,
-
1
)
)
{
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
const
char
*
psz_path
=
lua_tostring
(
L
,
-
1
);
lua_pop
(
L
,
1
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
lua_getfield
(
L
,
-
1
,
"title"
);
lua_getfield
(
L
,
-
2
,
"title"
);
const
char
*
psz_title
=
luaL_checkstring
(
L
,
-
1
)
?
luaL_checkstring
(
L
,
-
1
)
:
psz_path
;
/* The table must be at the top of the stack when calling
* vlclua_read_options() */
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
lua_pushvalue
(
L
,
-
3
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
input_item_t
*
p_input
=
input_item_NewExt
(
psz_path
,
psz_title
,
i_options
,
(
const
char
**
)
ppsz_options
,
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
3
);
if
(
p_input
)
{
...
...
@@ -310,16 +314,21 @@ static int vlclua_node_add_subitem( lua_State *L )
lua_getfield
(
L
,
-
1
,
"path"
);
if
(
lua_isstring
(
L
,
-
1
)
)
{
const
char
*
psz_path
=
lua_tostring
(
L
,
-
1
);
/* The table must be at the top of the stack when calling
* vlclua_read_options() */
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
const
char
*
psz_path
=
lua_tostring
(
L
,
-
1
);
lua_pushvalue
(
L
,
-
2
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
input_item_node_t
*
p_input_node
=
input_item_node_Create
(
*
pp_node
);
input_item_t
*
p_input
=
input_item_NewExt
(
psz_path
,
psz_path
,
i_options
,
(
const
char
**
)
ppsz_options
,
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
2
);
if
(
p_input
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment