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
58ad6be8
Commit
58ad6be8
authored
Oct 28, 2015
by
Shlomi Fish
Committed by
Jean-Baptiste Kempf
Oct 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: fix HTTP loadstring in lua 5.2+
Close #14988 Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
167830d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
share/lua/intf/http.lua
share/lua/intf/http.lua
+9
-1
share/lua/modules/sandbox.lua
share/lua/modules/sandbox.lua
+5
-2
No files found.
share/lua/intf/http.lua
View file @
58ad6be8
...
...
@@ -55,6 +55,14 @@ function escape(s)
return
(
string.gsub
(
s
,
"([%^%$%%%.%[%]%*%+%-%?])"
,
"%%%1"
))
end
function
my_vlc_load
(
code
,
filename
)
if
_VERSION
==
"Lua 5.1"
then
return
loadstring
(
code
,
filename
)
else
return
load
(
code
,
filename
)
end
end
function
process_raw
(
filename
)
local
input
=
io.open
(
filename
):
read
(
"*a"
)
-- find the longest [===[ or ]=====] type sequence and make sure that
...
...
@@ -77,7 +85,7 @@ function process_raw(filename)
io.write("\n")
end
--]]
return
assert
(
loadstring
(
code
,
filename
))
return
assert
(
my_vlc_load
(
code
,
filename
))
end
function
process
(
filename
)
...
...
share/lua/modules/sandbox.lua
View file @
58ad6be8
...
...
@@ -34,7 +34,6 @@ local sandbox_blacklist = {
getmetatable
=
true
,
load
=
true
,
-- Can be protected I guess
loadfile
=
true
,
-- Can be protected I guess
loadstring
=
true
,
-- Can be protected I guess
rawequal
=
true
,
rawget
=
true
,
rawset
=
true
,
...
...
@@ -46,6 +45,10 @@ local sandbox_blacklist = {
debug
=
true
,
}
if
_VERSION
==
"Lua 5.1"
then
sandbox_blacklist
[
"loadstring"
]
=
true
end
function
readonly_table_proxy
(
name
,
src
,
blacklist
)
if
type
(
src
)
==
"nil"
then
return
end
if
type
(
src
)
~=
"table"
then
error
(
"2nd argument must be a table (or nil)"
)
end
...
...
@@ -117,4 +120,4 @@ function sandbox(func,override)
setfenv
(
func
,
_G
)
return
unpack
(
ret
)
end
end
\ No newline at end of file
end
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