Protect against bad values in `current-module-declare-name'.

Closes PR 12125
This commit is contained in:
Eli Barzilay 2011-09-16 09:21:33 -04:00
parent 5cc277e40f
commit f02d19553c
2 changed files with 10 additions and 0 deletions

View File

@ -897,6 +897,9 @@
,@(sandbox-path-permissions))]
;; general info
[current-command-line-arguments '#()]
;; prevent a potential value here from messing up creating the sandboxed
;; module
[current-module-declare-name #f]
;; restrict the sandbox context from this point
[current-security-guard
(let ([g (sandbox-security-guard)]) (if (security-guard? g) g (g)))]

View File

@ -500,4 +500,11 @@
))
(parameterize ([current-module-declare-name (make-resolved-module-path 'junk)])
(define (avoid-module-declare-name)
(with-handlers ([exn? (lambda (_) #f)])
(kill-evaluator (make-evaluator 'racket/base))
#t))
(test #t avoid-module-declare-name))
(report-errs)