Skip to content

crypto.randomInt panics when called with no arguments #30313

@garretcarrot

Description

@garretcarrot

Version: Deno 2.4.3

The panic happens with import crypto from "node:crypto"; crypto.randomInt(); here's the full backtrace:

❱ RUST_BACKTRACE=1 target/debug/deno
Deno 2.4.3
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> import crypto from "node:crypto"; crypto.randomInt();

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 2.4.3
Args: ["target/debug/deno"]


thread 'main' panicked at /Users/garret/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand-0.8.5/src/distributions/uniform.rs:562:1:
Uniform::new called with `low >= high`
stack backtrace:
   0: rust_begin_unwind
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:145:5
   3: <rand::distributions::uniform::UniformInt<i64> as rand::distributions::uniform::UniformSampler>::new
             at /Users/garret/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand-0.8.5/src/distributions/uniform.rs:452:17
   4: rand::distributions::uniform::Uniform<X>::new
             at /Users/garret/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand-0.8.5/src/distributions/uniform.rs:189:17
   5: <rand::distributions::uniform::Uniform<X> as core::convert::From<core::ops::range::Range<X>>>::from
             at /Users/garret/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rand-0.8.5/src/distributions/uniform.rs:306:9
   6: deno_node::ops::crypto::op_node_random_int::op_node_random_int::call
             at ./ext/node/ops/crypto/mod.rs:624:14
   7: deno_node::ops::crypto::op_node_random_int::op_node_random_int::slow_function_impl
             at ./ext/node/ops/crypto/mod.rs:618:1
   8: deno_node::ops::crypto::op_node_random_int::op_node_random_int::v8_fn_ptr_metrics
             at ./ext/node/ops/crypto/mod.rs:618:1
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions