---
id: "CVE-2026-120439"
kind: "vulnerability"
aliases: ["CVE-2026-120439"]
title: "QuickJS-NG: integer overflow in typed array sort lets scripts corrupt memory"
severity: "high"
cvss: 8.3
epss: null
exploited: false
status: "open"
category: "runtime"
products: []
ecosystems: []
tags: ["32-bit", "embedded-js", "quickjs-ng", "runtime"]
not_affected_if: ["64-bit-host", "trusted-scripts-only", "version-0.16.0-or-later"]
published_at: "2026-11-02T15:17:25+00:00"
first_seen_at: "2026-11-02T15:24:02+00:00"
updated_at: "2026-11-02T15:26:01+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-120439", "first_seen_at": "2026-11-02T15:24:02+00:00"}]
---

# QuickJS-NG: integer overflow in typed array sort lets scripts corrupt memory

QuickJS-NG before 0.16.0 has an integer overflow in js_typed_array_sort() that wraps an allocation size on 32-bit hosts. A script calling TypedArray.prototype.sort with a comparator on a huge typed array can write past a heap buffer, crashing the engine or possibly running code.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the QuickJS-NG version embedded in your project, for example in `package.json` or vendored `quickjs.c`, against `0.16.0`.
- Check whether you run QuickJS-NG on a 32-bit host and whether untrusted JavaScript can reach it.

## Fix

- Move QuickJS-NG to `0.16.0` or later.

## Timeline

- 2026-11-02T15:24:02+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-120439

## Documents

- [advisory] Vendor advisory: github.com https://github.com/quickjs-ng/quickjs/security/advisories/GHSA-9wv5-5cgr-grj6
- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/quickjs-ng-before-0.16.0-heap-buffer-overflow-via-typedarray-prototype-sort
- [fix] Patch: github.com https://github.com/quickjs-ng/quickjs/commit/e93cca611908e12b824ec85fbee6b31a5ee61568
- [fix] Release notes: github.com https://github.com/quickjs-ng/quickjs/releases/tag/v0.16.0

## From the sources

QuickJS-NG before 0.16.0 contains an integer overflow in js_typed_array_sort() in quickjs.c that allows attackers to cause a heap buffer overflow on 32-bit hosts. Attackers who can run JavaScript can call TypedArray.prototype.sort with a comparator on a typed array near 2^30 elements, wrapping the allocation size and writing indices past the buffer to crash or potentially execute code.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
