Skip to content

Commit

Permalink
fix: clamp smi in fast calls by default (#26506)
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy authored and bartlomieju committed Nov 5, 2024
1 parent b9cec00 commit 13612e7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repository = "https://github.com/denoland/deno"

[workspace.dependencies]
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_lockfile = "=0.23.1"
Expand Down
8 changes: 4 additions & 4 deletions ext/node/ops/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,11 @@ pub fn op_node_dh_compute_secret(
}

#[op2(fast)]
#[smi]
#[number]
pub fn op_node_random_int(
#[smi] min: i32,
#[smi] max: i32,
) -> Result<i32, AnyError> {
#[number] min: i64,
#[number] max: i64,
) -> Result<i64, AnyError> {
let mut rng = rand::thread_rng();
// Uniform distribution is required to avoid Modulo Bias
// https://en.wikipedia.org/wiki/Fisher–Yates_shuffle#Modulo_bias
Expand Down
7 changes: 7 additions & 0 deletions runtime/inspector_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use deno_core::serde_json::Value;
use deno_core::unsync::spawn;
use deno_core::url::Url;
use deno_core::InspectorMsg;
use deno_core::InspectorSessionKind;
use deno_core::InspectorSessionOptions;
use deno_core::InspectorSessionProxy;
use deno_core::JsRuntime;
use fastwebsockets::Frame;
Expand Down Expand Up @@ -192,6 +194,11 @@ fn handle_ws_request(
let inspector_session_proxy = InspectorSessionProxy {
tx: outbound_tx,
rx: inbound_rx,
options: InspectorSessionOptions {
kind: InspectorSessionKind::NonBlocking {
wait_for_disconnect: true,
},
},
};

log::info!("Debugger session started.");
Expand Down
8 changes: 7 additions & 1 deletion runtime/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use deno_core::CompiledWasmModuleStore;
use deno_core::Extension;
use deno_core::FeatureChecker;
use deno_core::GetErrorClassFn;
use deno_core::InspectorSessionKind;
use deno_core::InspectorSessionOptions;
use deno_core::JsRuntime;
use deno_core::LocalInspectorSession;
use deno_core::ModuleCodeString;
Expand Down Expand Up @@ -792,7 +794,11 @@ impl MainWorker {
/// was not configured to create inspector.
pub fn create_inspector_session(&mut self) -> LocalInspectorSession {
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(
Expand Down

0 comments on commit 13612e7

Please sign in to comment.