A `BigInt` division panics, and two neighbouring operations answer wrongly in silence
`viperjs` is a JavaScript engine intended to run untrusted script inside a host application, so script text is data rather than a trusted caller and a panic reachable from script is a denial of service in the embedder's process. A divisor whose magnitude lands exactly on the engine's internal limb ceiling reaches an out-of-bounds index. On every released version up to and including 0.2.1: ```js const d = (1n << 33554399n) * 2n; 1n / d; // panic: index out of bounds ``` Two further operations on the same value returned wrong results without raising anything, which is the more dangerous half for an embedder that acts on the answer: ```js d % 7n; // 0n — the true remainder is 1n String(d); // "0" ``` ## Cause The left-shift helper reserved one limb for the bits a shift may push past the top of the magnitude, measured *that* width against the size ceiling, and then trimmed the reserved limb away again — so a magnitude landing exactly on the ceiling was refused on account of room it does not keep. The division treated that refusal as unreachable and discarded it with `unwrap_or_default`, leaving an empty divisor magnitude; the subsequent `divisor[n - 1]` is then an index of `usize::MAX`. The crate is `#![forbid(unsafe_code)]`, so this is a panic and not memory unsafety. ## Remediation Upgrade to 0.2.2, in which all three behaviours are fixed: both divisions now produce correct results, and `String()` of a magnitude beyond what the engine can divide raises a `RangeError` rather tha
- Products
- viperjs
- Affected versions
- Not specified
- Fixed versions
- 0.2.2
- CVEs
- Not specified
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 30 Oct 2026, 08:44 UTC · Revision 1
Source evidence
A `BigInt` division panics, and two neighbouring operations answer wrongly in silence
core-osv · Original sourcePublished 6 Aug 2026, 12:00 UTC
`viperjs` is a JavaScript engine intended to run untrusted script inside a host application, so script text is data rather than a trusted caller and a panic reachable from script is a denial of service in the embedder's process. A divisor whose magnitude lands exactly on the engine's internal limb ceiling reaches an out-of-bounds index. On every released version up to and including 0.2.1: ```js const d = (1n << 33554399n) * 2n; 1n / d; // panic: index out of bounds ``` Two further operations on the same value returned wrong results without raising anything, which is the more dangerous half for an embedder that acts on the answer: ```js d % 7n; // 0n — the true remainder is 1n String(d); // "0" ``` ## Cause The left-shift helper reserved one limb for the bits a shift may push past the top of the magnitude, measured *that* width against the size ceiling, and then trimmed the reserved limb away again — so a magnitude landing exactly on the ceiling was refused on account of room it does not keep. The division treated that refusal as unreachable and discarded it with `unwrap_or_default`, leaving an empty divisor magnitude; the subsequent `divisor[n - 1]` is then an index of `usize::MAX`. The crate is `#![forbid(unsafe_code)]`, so this is a panic and not memory unsafety. ## Remediation Upgrade to 0.2.2, in which all three behaviours are fixed: both divisions now produce correct results, and `String()` of a magnitude beyond what the engine can divide raises a `RangeError` rather tha
osv:RUSTSEC-2026-0236
viperjs
Fixed versions: 0.2.2
Complete source record
{
"id": "bb9d58ee8bc4b0da404e85628c63e830e91f3883bc70336bf2665e902016b299",
"url": "https://osv.dev/vulnerability/RUSTSEC-2026-0236",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "A `BigInt` division panics, and two neighbouring operations answer wrongly in silence",
"summary": "`viperjs` is a JavaScript engine intended to run untrusted script inside a host application, so script text is data rather than a trusted caller and a panic reachable from script is a denial of service in the embedder's process. A divisor whose magnitude lands exactly on the engine's internal limb ceiling reaches an out-of-bounds index. On every released version up to and including 0.2.1: ```js const d = (1n << 33554399n) * 2n; 1n / d; // panic: index out of bounds ``` Two further operations on the same value returned wrong results without raising anything, which is the more dangerous half for an embedder that acts on the answer: ```js d % 7n; // 0n — the true remainder is 1n String(d); // \"0\" ``` ## Cause The left-shift helper reserved one limb for the bits a shift may push past the top of the magnitude, measured *that* width against the size ceiling, and then trimmed the reserved limb away again — so a magnitude landing exactly on the ceiling was refused on account of room it does not keep. The division treated that refusal as unreachable and discarded it with `unwrap_or_default`, leaving an empty divisor magnitude; the subsequent `divisor[n - 1]` is then an index of `usize::MAX`. The crate is `#![forbid(unsafe_code)]`, so this is a panic and not memory unsafety. ## Remediation Upgrade to 0.2.2, in which all three behaviours are fixed: both divisions now produce correct results, and `String()` of a magnitude beyond what the engine can divide raises a `RangeError` rather tha",
"evidence": "osv:RUSTSEC-2026-0236",
"products": [
{
"name": {
"value": "viperjs",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.2.2",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "high",
"structured": {
"id": "RUSTSEC-2026-0236",
"aliases": [
"GHSA-6976-qm5m-7mcj",
"RUSTSEC-2026-0236"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "0.2.2"
}
]
}
],
"package": {
"name": "viperjs",
"purl": "pkg:cargo/viperjs",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0236.json",
"categories": [
"denial-of-service"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": []
},
"affected_functions": null
}
}
],
"modified": "2026-10-12T18:00:14.309974197Z",
"provider": "osv",
"references": [
"https://crates.io/crates/viperjs",
"https://rustsec.org/advisories/RUSTSEC-2026-0236.html",
"https://github.com/MerlijnW70/viperjs/commit/92988456c44fe7744c13cba1d891f127b8437f95",
"https://github.com/MerlijnW70/viperjs/releases/tag/v0.2.2"
],
"provider_metadata": {
"license": "CC0-1.0"
}
},
"related_cves": [],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 306459,
"published_at": "2026-08-06T12:00:00+00:00"
}