summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst/src/eval/import.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/typst/src/eval/import.rs b/crates/typst/src/eval/import.rs
index 68187a96..d02938cc 100644
--- a/crates/typst/src/eval/import.rs
+++ b/crates/typst/src/eval/import.rs
@@ -182,6 +182,12 @@ fn import_package(vm: &mut Vm, spec: PackageSpec, span: Span) -> SourceResult<Mo
// Evaluate the entry point.
let entrypoint_id = manifest_id.join(&manifest.package.entrypoint);
let source = vm.world().source(entrypoint_id).at(span)?;
+
+ // Prevent cyclic importing.
+ if vm.engine.route.contains(source.id()) {
+ bail!(span, "cyclic import");
+ }
+
let point = || Tracepoint::Import;
Ok(eval(
vm.world(),