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
60d35d6c
Commit
60d35d6c
authored
Jan 18, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid overflows in the LUA net API. Run-time behavior will still be incorrect however.
parent
0f9d30d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
modules/misc/lua/net.c
modules/misc/lua/net.c
+9
-1
No files found.
modules/misc/lua/net.c
View file @
60d35d6c
...
@@ -135,6 +135,9 @@ int vlclua_net_select( lua_State *L )
...
@@ -135,6 +135,9 @@ int vlclua_net_select( lua_State *L )
fd_set
*
fds_write
=
(
fd_set
*
)
luaL_checkuserdata
(
L
,
3
,
sizeof
(
fd_set
)
);
fd_set
*
fds_write
=
(
fd_set
*
)
luaL_checkuserdata
(
L
,
3
,
sizeof
(
fd_set
)
);
double
f_timeout
=
luaL_checknumber
(
L
,
4
);
double
f_timeout
=
luaL_checknumber
(
L
,
4
);
struct
timeval
timeout
;
struct
timeval
timeout
;
if
(
i_nfds
>
FD_SETSIZE
)
i_nfds
=
FD_SETSIZE
;
timeout
.
tv_sec
=
(
int
)
f_timeout
;
timeout
.
tv_sec
=
(
int
)
f_timeout
;
timeout
.
tv_usec
=
(
int
)(
1e6
*
(
f_timeout
-
(
double
)((
int
)
f_timeout
)));
timeout
.
tv_usec
=
(
int
)(
1e6
*
(
f_timeout
-
(
double
)((
int
)
f_timeout
)));
i_ret
=
select
(
i_nfds
,
fds_read
,
fds_write
,
0
,
&
timeout
);
i_ret
=
select
(
i_nfds
,
fds_read
,
fds_write
,
0
,
&
timeout
);
...
@@ -168,7 +171,12 @@ int vlclua_fd_set( lua_State *L )
...
@@ -168,7 +171,12 @@ int vlclua_fd_set( lua_State *L )
{
{
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkuserdata
(
L
,
1
,
sizeof
(
fd_set
)
);
fd_set
*
fds
=
(
fd_set
*
)
luaL_checkuserdata
(
L
,
1
,
sizeof
(
fd_set
)
);
int
i_fd
=
luaL_checkint
(
L
,
2
);
int
i_fd
=
luaL_checkint
(
L
,
2
);
FD_SET
(
i_fd
,
fds
);
/* FIXME: we should really use poll() instead here, but that breaks the
* VLC/LUA API*/
#ifndef WIN32
if
(
i_fd
<
FD_SETSIZE
)
#endif
FD_SET
(
i_fd
,
fds
);
return
0
;
return
0
;
}
}
int
vlclua_fd_zero
(
lua_State
*
L
)
int
vlclua_fd_zero
(
lua_State
*
L
)
...
...
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