@poe-platform/safe-bash 0.1.76 → 0.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/safe-bash/browser.js +25 -4
- package/dist/safe-bash/browser.js.map +3 -3
- package/dist/safe-bash/commands/regex-execution/matching.d.ts +1 -1
- package/dist/safe-bash/commands/regex-execution/matching.d.ts.map +1 -1
- package/dist/safe-bash/commands/regex-execution/matching.js +8 -4
- package/dist/safe-bash/commands/regex-execution/matching.js.map +1 -1
- package/dist/safe-bash/commands/regex-execution/protocol.d.ts +4 -0
- package/dist/safe-bash/commands/regex-execution/protocol.d.ts.map +1 -1
- package/dist/safe-bash/commands/regex-execution/protocol.js +30 -5
- package/dist/safe-bash/commands/regex-execution/protocol.js.map +1 -1
- package/dist/safe-bash/commands/regex-execution/worker.js +7 -1
- package/dist/safe-bash/commands/regex-execution/worker.js.map +1 -1
- package/package.json +2 -2
|
@@ -16293,6 +16293,7 @@ var RegexExecutionError = class extends Error {
|
|
|
16293
16293
|
}
|
|
16294
16294
|
code;
|
|
16295
16295
|
};
|
|
16296
|
+
var matchRangeLimits = Object.freeze({ perRow: 1e5, perReply: 1e5 });
|
|
16296
16297
|
var exprMatchCeilings = Object.freeze({
|
|
16297
16298
|
maxPatternBytes: 65536,
|
|
16298
16299
|
maxSubjectBytes: 1048576,
|
|
@@ -16393,13 +16394,28 @@ function validateReply(value2, id, rows, signal) {
|
|
|
16393
16394
|
throw new RegexExecutionError("MATCH", reply.error);
|
|
16394
16395
|
}
|
|
16395
16396
|
if (!("results" in reply) || !Array.isArray(reply.results) || reply.results.length !== rows.length) throw new RegexExecutionError("PROTOCOL", "invalid reply rows");
|
|
16396
|
-
|
|
16397
|
+
let total = 0;
|
|
16398
|
+
const lengths = [];
|
|
16399
|
+
for (let index = 0; index < reply.results.length; index++) {
|
|
16397
16400
|
signal.throwIfAborted();
|
|
16398
|
-
|
|
16401
|
+
const ranges = reply.results[index];
|
|
16402
|
+
const row = rows[index];
|
|
16403
|
+
if (!(ranges instanceof Float64Array)) throw new RegexExecutionError("PROTOCOL", "invalid match ranges");
|
|
16404
|
+
const length = ranges.length;
|
|
16405
|
+
if (length % 2 || length > 2 * (row.bytes.length + 1)) throw new RegexExecutionError("PROTOCOL", "invalid match ranges");
|
|
16406
|
+
if (!row.all && length > 2) throw new RegexExecutionError("PROTOCOL", "unexpected multiple matches");
|
|
16407
|
+
const count2 = length / 2;
|
|
16408
|
+
if (count2 > matchRangeLimits.perRow || count2 > matchRangeLimits.perReply - total) throw new RegexExecutionError("PROTOCOL", "match range limit exceeded");
|
|
16409
|
+
total += count2;
|
|
16410
|
+
lengths.push(length);
|
|
16411
|
+
}
|
|
16412
|
+
const results = reply.results.map((ranges, index) => {
|
|
16413
|
+
signal.throwIfAborted();
|
|
16414
|
+
const length = lengths[index];
|
|
16415
|
+
if (ranges.length !== length) throw new RegexExecutionError("PROTOCOL", "match ranges changed after admission");
|
|
16399
16416
|
const result = [];
|
|
16400
16417
|
const row = rows[index];
|
|
16401
|
-
|
|
16402
|
-
for (let offset = 0; offset < ranges.length; offset += 2) {
|
|
16418
|
+
for (let offset = 0; offset < length; offset += 2) {
|
|
16403
16419
|
signal.throwIfAborted();
|
|
16404
16420
|
const start = ranges[offset];
|
|
16405
16421
|
const end = ranges[offset + 1];
|
|
@@ -16408,6 +16424,11 @@ function validateReply(value2, id, rows, signal) {
|
|
|
16408
16424
|
}
|
|
16409
16425
|
return result;
|
|
16410
16426
|
});
|
|
16427
|
+
for (let index = 0; index < reply.results.length; index++) {
|
|
16428
|
+
signal.throwIfAborted();
|
|
16429
|
+
if (reply.results[index].length !== lengths[index]) throw new RegexExecutionError("PROTOCOL", "match ranges changed after admission");
|
|
16430
|
+
}
|
|
16431
|
+
return results;
|
|
16411
16432
|
}
|
|
16412
16433
|
|
|
16413
16434
|
// packages/safe-bash/src/commands/regex-execution/portable.ts
|