fix: clamp smi in fast calls by default (#26506)

Fixes https://github.com/denoland/deno/issues/26480

Ref
d2945fb65b
This commit is contained in:
Divy Srivastava 2024-10-31 10:10:07 +05:30 committed by GitHub
parent a8846eb70f
commit 8bfd134da6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 12 deletions

12
Cargo.lock generated
View File

@ -1418,9 +1418,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_core" name = "deno_core"
version = "0.314.2" version = "0.316.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83138917579676069b423c3eb9be3c1e579f60dc022d85f6ded4c792456255ff" checksum = "94f68061c88ced959c6b0417f0f0d0b3dbeaeb18013b55f86c505e9fba705cf8"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -1921,9 +1921,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ops" name = "deno_ops"
version = "0.190.1" version = "0.192.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26f46d4e4f52f26c882b74a9b58810ea75252b807cf0966166ec333077cdfd85" checksum = "bdb7096887508456349d7e7e09e326d157d4dba46ef1f5849bc544592ea3042a"
dependencies = [ dependencies = [
"proc-macro-rules", "proc-macro-rules",
"proc-macro2", "proc-macro2",
@ -6169,9 +6169,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_v8" name = "serde_v8"
version = "0.223.1" version = "0.225.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cf3d859dda87ee96423c01244f10af864fa6d6a9fcdc2b77e0595078ea0ea11" checksum = "ce4b71200ef49a9e629edaea3d13fc98c25ede07e1496558df7f09354e37976f"
dependencies = [ dependencies = [
"num-bigint", "num-bigint",
"serde", "serde",

View File

@ -46,7 +46,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies] [workspace.dependencies]
deno_ast = { version = "=0.42.2", features = ["transpiling"] } deno_ast = { version = "=0.42.2", features = ["transpiling"] }
deno_core = { version = "0.314.2" } deno_core = { version = "0.316.0" }
deno_bench_util = { version = "0.169.0", path = "./bench_util" } deno_bench_util = { version = "0.169.0", path = "./bench_util" }
deno_lockfile = "=0.23.1" deno_lockfile = "=0.23.1"

View File

@ -519,11 +519,11 @@ pub fn op_node_dh_compute_secret(
} }
#[op2(fast)] #[op2(fast)]
#[smi] #[number]
pub fn op_node_random_int( pub fn op_node_random_int(
#[smi] min: i32, #[number] min: i64,
#[smi] max: i32, #[number] max: i64,
) -> Result<i32, AnyError> { ) -> Result<i64, AnyError> {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
// Uniform distribution is required to avoid Modulo Bias // Uniform distribution is required to avoid Modulo Bias
// https://en.wikipedia.org/wiki/FisherYates_shuffle#Modulo_bias // https://en.wikipedia.org/wiki/FisherYates_shuffle#Modulo_bias

View File

@ -19,6 +19,8 @@ use deno_core::serde_json::Value;
use deno_core::unsync::spawn; use deno_core::unsync::spawn;
use deno_core::url::Url; use deno_core::url::Url;
use deno_core::InspectorMsg; use deno_core::InspectorMsg;
use deno_core::InspectorSessionKind;
use deno_core::InspectorSessionOptions;
use deno_core::InspectorSessionProxy; use deno_core::InspectorSessionProxy;
use deno_core::JsRuntime; use deno_core::JsRuntime;
use fastwebsockets::Frame; use fastwebsockets::Frame;
@ -192,6 +194,11 @@ fn handle_ws_request(
let inspector_session_proxy = InspectorSessionProxy { let inspector_session_proxy = InspectorSessionProxy {
tx: outbound_tx, tx: outbound_tx,
rx: inbound_rx, rx: inbound_rx,
options: InspectorSessionOptions {
kind: InspectorSessionKind::NonBlocking {
wait_for_disconnect: true,
},
},
}; };
log::info!("Debugger session started."); log::info!("Debugger session started.");

View File

@ -20,6 +20,8 @@ use deno_core::CompiledWasmModuleStore;
use deno_core::Extension; use deno_core::Extension;
use deno_core::FeatureChecker; use deno_core::FeatureChecker;
use deno_core::GetErrorClassFn; use deno_core::GetErrorClassFn;
use deno_core::InspectorSessionKind;
use deno_core::InspectorSessionOptions;
use deno_core::JsRuntime; use deno_core::JsRuntime;
use deno_core::LocalInspectorSession; use deno_core::LocalInspectorSession;
use deno_core::ModuleCodeString; use deno_core::ModuleCodeString;
@ -792,7 +794,11 @@ impl MainWorker {
/// was not configured to create inspector. /// was not configured to create inspector.
pub fn create_inspector_session(&mut self) -> LocalInspectorSession { pub fn create_inspector_session(&mut self) -> LocalInspectorSession {
self.js_runtime.maybe_init_inspector(); self.js_runtime.maybe_init_inspector();
self.js_runtime.inspector().borrow().create_local_session() self.js_runtime.inspector().borrow().create_local_session(
InspectorSessionOptions {
kind: InspectorSessionKind::Blocking,
},
)
} }
pub async fn run_event_loop( pub async fn run_event_loop(