mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 07:15:11 -04:00
closes #2507
/bin/less and /bin/more were able to lock up the system if they call string.gsub(string, function) on a very large string (~144k chars long). The machine layer intercepts expensive strings calls by checking the length of the string, but it does not intercept gsub calls when the replace action is a function The fix is to intercept all long string actions, not just non-function replacement gsub calls Note that /bin/more is now more efficient and doesn't call string.gsub, but this is still the right fix to keep the sandbox from being able to lock up the system with string methods
This commit is contained in:
parent
47c67a119f
commit
2abd8b3134
@ -577,7 +577,7 @@ do
|
||||
checkArg(3, repl, "number", "string", "function", "table")
|
||||
checkArg(4, n, "number", "nil")
|
||||
|
||||
if #s < SHORT_STRING or type(repl) == "function" then
|
||||
if #s < SHORT_STRING then
|
||||
return string_gsub(s, pattern, repl, n)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user