summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-03-19 20:33:53 +0000
committerAlex Orlenko <zxteam@protonmail.com>2022-03-21 01:08:47 +0000
commit1e61d1dadc725324b61c8d833521c65653a384e3 (patch)
tree6d2809f60703877310ff8bed91a516749a7e39f3 /tests
parent32124b31a05a25c0146864661f3a34a8abb1a7d6 (diff)
downloadmlua-1e61d1dadc725324b61c8d833521c65653a384e3.zip
Return binary chunks support in safe mode.
Lua has many ways to load binary bytecode and this restriction was easy to bypass.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index fa53b28..8dc80ad 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -47,23 +47,6 @@ fn test_safety() -> Result<()> {
Err(e) => panic!("expected RuntimeError, got {:?}", e),
Ok(_) => panic!("expected RuntimeError, got no error"),
}
-
- match lua.load("1 + 1").set_mode(ChunkMode::Binary).exec() {
- Err(Error::SafetyError(msg)) => {
- assert!(msg.contains("binary chunks are disabled in safe mode"))
- }
- Err(e) => panic!("expected SafetyError, got {:?}", e),
- Ok(_) => panic!("expected SafetyError, got no error"),
- }
-
- let bytecode = lua.load("return 1 + 1").into_function()?.dump(true);
- match lua.load(&bytecode).exec() {
- Err(Error::SafetyError(msg)) => {
- assert!(msg.contains("binary chunks are disabled in safe mode"))
- }
- Err(e) => panic!("expected SafetyError, got {:?}", e),
- Ok(_) => panic!("expected SafetyError, got no error"),
- }
drop(lua);
// Test safety rules after dynamically loading `package` library