Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
9c1cb680
Commit
9c1cb680
authored
Nov 10, 2009
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lua: check variable type before adding a callback
parent
e74515cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
modules/misc/lua/libs/variables.c
modules/misc/lua/libs/variables.c
+21
-0
No files found.
modules/misc/lua/libs/variables.c
View file @
9c1cb680
...
@@ -342,6 +342,27 @@ static int vlclua_add_callback( lua_State *L )
...
@@ -342,6 +342,27 @@ static int vlclua_add_callback( lua_State *L )
lua_settop
(
L
,
4
);
/* makes sure that optional data arg is set */
lua_settop
(
L
,
4
);
/* makes sure that optional data arg is set */
if
(
!
lua_isfunction
(
L
,
3
)
)
if
(
!
lua_isfunction
(
L
,
3
)
)
return
vlclua_error
(
L
);
return
vlclua_error
(
L
);
if
(
!
pp_obj
||
!*
pp_obj
)
return
vlclua_error
(
L
);
/* Check variable type, in order to avoid PANIC */
switch
(
var_Type
(
*
pp_obj
,
psz_var
)
)
{
case
VLC_VAR_BOOL
:
case
VLC_VAR_INTEGER
:
case
VLC_VAR_STRING
:
case
VLC_VAR_FLOAT
:
case
VLC_VAR_TIME
:
break
;
case
VLC_VAR_ADDRESS
:
case
VLC_VAR_VOID
:
case
VLC_VAR_MUTEX
:
case
VLC_VAR_LIST
:
default:
return
vlclua_error
(
L
);
}
i_index
++
;
i_index
++
;
p_callback
=
(
vlclua_callback_t
*
)
malloc
(
sizeof
(
vlclua_callback_t
)
);
p_callback
=
(
vlclua_callback_t
*
)
malloc
(
sizeof
(
vlclua_callback_t
)
);
...
...
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