-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable some lua functions #306
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
22930d6
disable the 'require' statement on V4
kroggen 4036fc1
test: fix gas on V4
kroggen 8f91f04
integration test: fix gas on V4
kroggen b9d3bb5
luajit: fully disable unused modules
kroggen 9cee33b
add tests for disabled Lua functions
kroggen b9532a2
disable more lua functions
kroggen ddbe34d
fix tests for getfenv and setfenv
kroggen 643c533
fix integration test
kroggen 9403750
disable string.dump()
kroggen e5081e4
disable getmetatable and setmetatable
kroggen cf7bd7d
disable rawget, rawset and rawequal
kroggen f545579
Merge branch 'topic/hardfork-v4' into topic/disable-lua-require
kroggen 53bdc73
limit metamethod override test to <= V3
kroggen 03995eb
Merge branch 'topic/hardfork-v4' into topic/disable-lua-require
kroggen fb3f70e
fix gas on integration test
kroggen 36aa884
Merge branch 'topic/hardfork-v4' into topic/disable-lua-require
kroggen 5abcf7c
Merge branch 'topic/hardfork-v4' into topic/disable-lua-require
kroggen 8a8a0db
Merge branch 'topic/hardfork-v4' into topic/disable-lua-require
kroggen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
function check_disabled_functions() | ||
|
||
-- check the disabled modules | ||
assert(os == nil, "os is available") | ||
assert(io == nil, "io is available") | ||
assert(debug == nil, "debug is available") | ||
assert(jit == nil, "jit is available") | ||
assert(ffi == nil, "ffi is available") | ||
assert(coroutine == nil, "coroutine is available") | ||
assert(package == nil, "package is available") | ||
|
||
-- check the disabled functions | ||
assert(collectgarbage == nil, "collectgarbage is available") | ||
assert(gcinfo == nil, "gcinfo is available") | ||
assert(module == nil, "module is available") | ||
assert(require == nil, "require is available") | ||
assert(dofile == nil, "dofile is available") | ||
assert(load == nil, "load is available") | ||
assert(loadlib == nil, "loadlib is available") | ||
assert(loadfile == nil, "loadfile is available") | ||
assert(loadstring == nil, "loadstring is available") | ||
assert(print == nil, "print is available") | ||
assert(getmetatable == nil, "getmetatable is available") | ||
assert(setmetatable == nil, "setmetatable is available") | ||
assert(rawget == nil, "rawget is available") | ||
assert(rawset == nil, "rawset is available") | ||
assert(rawequal == nil, "rawequal is available") | ||
assert(string.dump == nil, "string.dump is available") | ||
|
||
local success, result = pcall(function() newproxy() end) | ||
assert(success == false and result:match(".* 'newproxy' not supported"), "newproxy is available") | ||
local success, result = pcall(function() setfenv() end) | ||
assert(success == false and result:match(".* 'setfenv' not supported"), "setfenv is available") | ||
local success, result = pcall(function() getfenv() end) | ||
assert(success == false and result:match(".* 'getfenv' not supported"), "getfenv is available") | ||
|
||
-- make sure the tostring does not return a pointer | ||
local tab = {} | ||
assert(not tostring(type):match("0x[%x]+"), "tostring returns a pointer for function") | ||
assert(not tostring(system):match("0x[%x]+"), "tostring returns a pointer for internal table") | ||
assert(not tostring(tab):match("0x[%x]+"), "tostring returns a pointer for table") | ||
|
||
end | ||
|
||
abi.register(check_disabled_functions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't review deeper code about getmemtable, but it doesn't look like addtion rather substraction. Anyway, if this code did not cause any problem, we can leave this as is, since this commit don't change the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this test overrides the add (
+
) operator with a subtraction (-
) to check if that feature of overriding functions is possible. the feature is disabled by this PR