+29
-4
@@ -318,3 +318,9 @@ #include "./wrapped_re2.h" | ||
| { | ||
| argv.push_back(Nan::CopyBuffer(data, item.size()).ToLocalChecked()); | ||
| auto buffer = Nan::CopyBuffer(data, item.size()); | ||
| if (buffer.IsEmpty()) | ||
| { | ||
| Nan::ThrowRangeError("Invalid string length"); | ||
| return Nan::Nothing<std::string>(); | ||
| } | ||
| argv.push_back(buffer.ToLocalChecked()); | ||
| } | ||
@@ -336,3 +342,9 @@ else | ||
| { | ||
| argv.push_back(Nan::New(data, item.size()).ToLocalChecked()); | ||
| auto text = Nan::New(data, item.size()); | ||
| if (text.IsEmpty()) | ||
| { | ||
| Nan::ThrowRangeError("Invalid string length"); | ||
| return Nan::Nothing<std::string>(); | ||
| } | ||
| argv.push_back(text.ToLocalChecked()); | ||
| } | ||
@@ -556,6 +568,19 @@ else | ||
| { | ||
| info.GetReturnValue().Set(Nan::CopyBuffer(result.data(), result.size()).ToLocalChecked()); | ||
| auto buffer = Nan::CopyBuffer(result.data(), result.size()); | ||
| if (buffer.IsEmpty()) | ||
| { | ||
| Nan::ThrowRangeError("Invalid string length"); | ||
| return; | ||
| } | ||
| info.GetReturnValue().Set(buffer.ToLocalChecked()); | ||
| return; | ||
| } | ||
| info.GetReturnValue().Set(Nan::New(result).ToLocalChecked()); | ||
| // over-max-length result -> empty MaybeLocal; ToLocalChecked() would abort() | ||
| auto text = Nan::New(result); | ||
| if (text.IsEmpty()) | ||
| { | ||
| Nan::ThrowRangeError("Invalid string length"); | ||
| return; | ||
| } | ||
| info.GetReturnValue().Set(text.ToLocalChecked()); | ||
| } |
+3
-5
| { | ||
| "name": "re2", | ||
| "version": "1.25.0", | ||
| "version": "1.25.1", | ||
| "description": "Bindings for RE2: fast, safe alternative to backtracking regular expression engines.", | ||
@@ -25,7 +25,7 @@ "homepage": "https://github.com/uhop/node-re2", | ||
| "devDependencies": { | ||
| "@types/node": "^25.9.3", | ||
| "@types/node": "^26.0.1", | ||
| "@unicode/unicode-17.0.0": "^1.6.17", | ||
| "nano-benchmark": "^1.0.16", | ||
| "prettier": "^3.8.4", | ||
| "tape-six": "^1.10.1", | ||
| "tape-six": "^1.14.0", | ||
| "tape-six-proc": "^1.3.1", | ||
@@ -69,4 +69,2 @@ "typescript": "^6.0.3" | ||
| "funding": "https://github.com/sponsors/uhop", | ||
| "llms": "https://raw.githubusercontent.com/uhop/node-re2/master/llms.txt", | ||
| "llmsFull": "https://raw.githubusercontent.com/uhop/node-re2/master/llms-full.txt", | ||
| "license": "BSD-3-Clause", | ||
@@ -73,0 +71,0 @@ "tape6": { |
+2
-7
@@ -254,10 +254,4 @@ # node-re2 [![NPM version][npm-img]][npm-url] | ||
| `re2` supports the Node.js versions declared in its `engines` field: | ||
| `re2` supports every non-EOL Node.js release — current and active LTS lines. As a native (`nan`) addon it runs on Node.js only, not Bun or Deno. The authoritative supported range is the `engines` field in `package.json`; it also pins the minimum patch releases the build toolchain ([`node-gyp`](https://github.com/nodejs/node-gyp) 13) requires. Check `engines` for the exact floor rather than a version repeated here. | ||
| ``` | ||
| ^22.22.2 || ^24.15.0 || >=26.0.0 | ||
| ``` | ||
| As of 1.25.0 this range was narrowed to mirror [`node-gyp`](https://github.com/nodejs/node-gyp) 13, which `re2` builds with (and which fixes a Node 26 build on Windows): **Node 25.x and the older 22.0–22.22.1 / 24.0–24.14 patch ranges are no longer supported.** Use a current release of an active line — Node 22 (≥ 22.22.2), 24 (≥ 24.15.0), or 26 and later. | ||
| ### Install scripts (npm 12+) | ||
@@ -446,2 +440,3 @@ | ||
| - 1.25.1 *Security fix (GHSA-8hcv-x26h-mcgp): a global `replace()` using an output-amplifying template (`$'` or `` $` ``) on very large input could exceed V8's maximum string length and abort the whole process. It now throws a catchable `RangeError`, matching the built-in engine.* | ||
| - 1.25.0 *Full Unicode 17.0.0 property classes (Fixes #226). New `maxMem` option for `RE2.Set`. Faster matching on pure-ASCII inputs. Narrowed Node support — drops Node 25.x and older patch releases.* | ||
@@ -448,0 +443,0 @@ - 1.24.1 *Support for Node 22, 24, 26 + precompiled binaries.* |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
13135852
0.01%476
-1.04%2
100%