From ad77ba0f7b40760e04b79d9789da16d7c49010b8 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Thu, 23 Mar 2023 16:00:46 -0600 Subject: fix(core): panic at build time if extension code contains anything other than 7-bit ASCII (#18372) This will improve diagnostics and catch any non-ASCII extension code early. This will use `debug_assert!` rather than `assert!` to avoid runtime costs, and ensures (in debug_assert mode only) that all extension source files are ASCII as we load them. --- core/runtime.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/runtime.rs') diff --git a/core/runtime.rs b/core/runtime.rs index c5afbda53..787bac972 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -751,7 +751,7 @@ impl JsRuntime { realm.execute_script( self.v8_isolate(), file_source.specifier, - file_source.code.load()?, + file_source.load()?, )?; } } @@ -2544,7 +2544,7 @@ impl JsRealm { let scope = &mut self.handle_scope(isolate); let source = Self::string_from_code(scope, &source_code).unwrap(); - assert!(name.is_ascii()); + debug_assert!(name.is_ascii()); let name = v8::String::new_external_onebyte_static(scope, name.as_bytes()).unwrap(); let origin = bindings::script_origin(scope, name); -- cgit v1.2.3