Blame swipl-7.2.3-FIXED-sandbox-handling-of-2.-Vladislav-Zorov-and.patch

d27b18
From 649ccc9e494cfb121cd20fad0c7bdd9121ddcace Mon Sep 17 00:00:00 2001
d27b18
From: Jan Wielemaker <j.wielemaker@cs.vu.nl>
d27b18
Date: Sun, 16 Jul 2017 17:40:05 +0200
d27b18
Subject: [PATCH] FIXED: sandbox handling of @/2. Vladislav Zorov and Anne
d27b18
 Ogborn.
d27b18
MIME-Version: 1.0
d27b18
Content-Type: text/plain; charset=UTF-8
d27b18
Content-Transfer-Encoding: 8bit
d27b18
d27b18
Petr Písař: Ported to 7.2.3.
d27b18
d27b18
Signed-off-by: Petr Písař <ppisar@redhat.com>
d27b18
---
d27b18
 library/sandbox.pl                | 6 +++++-
d27b18
 src/Tests/library/test_sandbox.pl | 2 ++
d27b18
 2 files changed, 7 insertions(+), 1 deletion(-)
d27b18
d27b18
diff --git a/library/sandbox.pl b/library/sandbox.pl
d27b18
index f84b8d3..bb970cb 100644
d27b18
--- a/library/sandbox.pl
d27b18
+++ b/library/sandbox.pl
d27b18
@@ -198,8 +198,10 @@ safe(G, M, Parents, _, _) :-
d27b18
 	fail.
d27b18
 
d27b18
 safe_clauses(G, M, Parents, Safe0, Safe) :-
d27b18
-	predicate_property(M:G, interpreted), !,
d27b18
+	predicate_property(M:G, interpreted),
d27b18
 	def_module(M:G, MD:QG),
d27b18
+	\+ compiled(MD:QG),
d27b18
+	!,
d27b18
 	findall(Ref-Body, clause(MD:QG, Body, Ref), Bodies),
d27b18
 	safe_bodies(Bodies, MD, Parents, Safe0, Safe).
d27b18
 safe_clauses(G, M, [_|Parents], _, _) :-
d27b18
@@ -210,6 +212,8 @@ safe_clauses(_, _, [G|Parents], _, _) :-
d27b18
 	throw(error(existence_error(procedure, G),
d27b18
 		    sandbox(G, Parents))).
d27b18
 
d27b18
+compiled(system:(@(_,_))).
d27b18
+
d27b18
 %%	safe_bodies(+Bodies, +Module, +Parents, +Safe0, -Safe)
d27b18
 %
d27b18
 %	Verify the safety of bodies. If  a   clause  was compiled with a
d27b18
diff --git a/src/Tests/library/test_sandbox.pl b/src/Tests/library/test_sandbox.pl
d27b18
index 4c737e8..1e14e85 100644
d27b18
--- a/src/Tests/library/test_sandbox.pl
d27b18
+++ b/src/Tests/library/test_sandbox.pl
d27b18
@@ -66,5 +66,7 @@ test(aggregate) :-
d27b18
 	safe_goal(aggregate(sum(I), X^between(1,X,I), _Count)).
d27b18
 test(dcg, error(permission_error(call, sandboxed, open(_,_,_)))) :-
d27b18
 	safe_goal(my_call(open(_,_,_))).
d27b18
+test(contexr, error(permission_error(call, sandboxed, @(_,_)))) :-
d27b18
+	safe_goal(@(open(_,_,_), user)).
d27b18
 
d27b18
 :- end_tests(sandbox).
d27b18
-- 
d27b18
2.13.6
d27b18