@poe-platform/safe-bash 0.1.758 → 0.1.759
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/image-ast/index.browser.js +15 -5
- package/dist/image-ast/index.js +15 -5
- package/dist/pdf-ast/index.js +15 -5
- package/dist/safe-bash/chunks/{chunk-WNWIBBJZ.js → chunk-AYPUGSOV.js} +7 -1
- package/dist/safe-bash/command-chunks/{chunk-XYCWDGOG.js → chunk-7JA44PVV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TCAGGM44.js → chunk-BAUGDXLZ.js} +15 -6
- package/dist/safe-bash/command-chunks/{chunk-L2C5TIII.js → chunk-HVEAK3OS.js} +2 -2
- package/dist/safe-bash/commands/python/index.browser.js +1 -1
- package/dist/safe-bash/commands/python/shell-capability.js +10 -2
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash-command-ffmpeg/index.js +618 -613
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +15 -5
- package/dist/safe-bash-command-pdfinfo/index.js +15 -5
- package/dist/safe-bash-command-pdftk/index.js +15 -5
- package/dist/safe-bash-command-pdftoppm/index.js +15 -5
- package/dist/safe-bash-command-pdftotext/index.js +15 -5
- package/dist/safe-bash-command-qpdf/index.js +15 -5
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +37 -27
- package/dist/safe-bash-command-wkhtmltopdf/index.js +16 -5
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +14 -0
|
@@ -8654,6 +8654,7 @@ var messages_default2 = {
|
|
|
8654
8654
|
"-5": "buffer error",
|
|
8655
8655
|
"-6": "incompatible version"
|
|
8656
8656
|
};
|
|
8657
|
+
var Z_BUF_ERROR = -5;
|
|
8657
8658
|
var MAX_MEM_LEVEL2 = 9;
|
|
8658
8659
|
var HEAP_SIZE2 = 573;
|
|
8659
8660
|
var MIN_MATCH2 = 3;
|
|
@@ -30545,22 +30546,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
30545
30546
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
30546
30547
|
} catch (error) {
|
|
30547
30548
|
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
30549
|
+
const wrapped = bytes[0] === 31 && bytes[1] === 139 || bytes.length >= 2 && (bytes[0] & 15) === 8 && bytes[0] >>> 4 <= 7 && (bytes[0] << 8 | bytes[1]) % 31 === 0;
|
|
30548
30550
|
const decoder = new Inflate2({
|
|
30549
|
-
raw: !
|
|
30551
|
+
raw: !wrapped,
|
|
30550
30552
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
30551
30553
|
});
|
|
30554
|
+
const chunks = [];
|
|
30552
30555
|
let length = 0;
|
|
30553
30556
|
decoder.onData = (chunk) => {
|
|
30554
30557
|
length += chunk.length;
|
|
30555
30558
|
if (length > maxDecodedBytes) {
|
|
30556
30559
|
throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
30557
30560
|
}
|
|
30558
|
-
|
|
30561
|
+
chunks.push(chunk);
|
|
30559
30562
|
};
|
|
30560
|
-
|
|
30563
|
+
const complete2 = decoder.push(bytes, true);
|
|
30564
|
+
const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
|
|
30565
|
+
if ((!complete2 || decoder.err || !decoder.ended) && !truncated) {
|
|
30561
30566
|
throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
30562
30567
|
}
|
|
30563
|
-
inflated =
|
|
30568
|
+
inflated = new Uint8Array(length);
|
|
30569
|
+
let offset = 0;
|
|
30570
|
+
for (const chunk of chunks) {
|
|
30571
|
+
inflated.set(chunk, offset);
|
|
30572
|
+
offset += chunk.length;
|
|
30573
|
+
}
|
|
30564
30574
|
}
|
|
30565
30575
|
return applyPredictor(inflated, parms);
|
|
30566
30576
|
}
|
|
@@ -42450,7 +42460,7 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
42450
42460
|
const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
|
|
42451
42461
|
const widths = /* @__PURE__ */ new Map();
|
|
42452
42462
|
let defaultWidth = 556;
|
|
42453
|
-
const isTwoByteCid = subtype === "Type0"
|
|
42463
|
+
const isTwoByteCid = subtype === "Type0";
|
|
42454
42464
|
let fontMatrix;
|
|
42455
42465
|
let charProcs;
|
|
42456
42466
|
let fontResources;
|
package/dist/image-ast/index.js
CHANGED
|
@@ -8654,6 +8654,7 @@ var messages_default2 = {
|
|
|
8654
8654
|
"-5": "buffer error",
|
|
8655
8655
|
"-6": "incompatible version"
|
|
8656
8656
|
};
|
|
8657
|
+
var Z_BUF_ERROR = -5;
|
|
8657
8658
|
var MAX_MEM_LEVEL2 = 9;
|
|
8658
8659
|
var HEAP_SIZE2 = 573;
|
|
8659
8660
|
var MIN_MATCH2 = 3;
|
|
@@ -30545,22 +30546,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
30545
30546
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
30546
30547
|
} catch (error) {
|
|
30547
30548
|
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
30549
|
+
const wrapped = bytes[0] === 31 && bytes[1] === 139 || bytes.length >= 2 && (bytes[0] & 15) === 8 && bytes[0] >>> 4 <= 7 && (bytes[0] << 8 | bytes[1]) % 31 === 0;
|
|
30548
30550
|
const decoder = new Inflate2({
|
|
30549
|
-
raw: !
|
|
30551
|
+
raw: !wrapped,
|
|
30550
30552
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
30551
30553
|
});
|
|
30554
|
+
const chunks = [];
|
|
30552
30555
|
let length = 0;
|
|
30553
30556
|
decoder.onData = (chunk) => {
|
|
30554
30557
|
length += chunk.length;
|
|
30555
30558
|
if (length > maxDecodedBytes) {
|
|
30556
30559
|
throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
30557
30560
|
}
|
|
30558
|
-
|
|
30561
|
+
chunks.push(chunk);
|
|
30559
30562
|
};
|
|
30560
|
-
|
|
30563
|
+
const complete2 = decoder.push(bytes, true);
|
|
30564
|
+
const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
|
|
30565
|
+
if ((!complete2 || decoder.err || !decoder.ended) && !truncated) {
|
|
30561
30566
|
throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
30562
30567
|
}
|
|
30563
|
-
inflated =
|
|
30568
|
+
inflated = new Uint8Array(length);
|
|
30569
|
+
let offset = 0;
|
|
30570
|
+
for (const chunk of chunks) {
|
|
30571
|
+
inflated.set(chunk, offset);
|
|
30572
|
+
offset += chunk.length;
|
|
30573
|
+
}
|
|
30564
30574
|
}
|
|
30565
30575
|
return applyPredictor(inflated, parms);
|
|
30566
30576
|
}
|
|
@@ -42450,7 +42460,7 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
42450
42460
|
const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
|
|
42451
42461
|
const widths = /* @__PURE__ */ new Map();
|
|
42452
42462
|
let defaultWidth = 556;
|
|
42453
|
-
const isTwoByteCid = subtype === "Type0"
|
|
42463
|
+
const isTwoByteCid = subtype === "Type0";
|
|
42454
42464
|
let fontMatrix;
|
|
42455
42465
|
let charProcs;
|
|
42456
42466
|
let fontResources;
|
package/dist/pdf-ast/index.js
CHANGED
|
@@ -644,6 +644,7 @@ var messages_default = {
|
|
|
644
644
|
"-5": "buffer error",
|
|
645
645
|
"-6": "incompatible version"
|
|
646
646
|
};
|
|
647
|
+
var Z_BUF_ERROR = -5;
|
|
647
648
|
var MAX_MEM_LEVEL = 9;
|
|
648
649
|
var HEAP_SIZE = 573;
|
|
649
650
|
var MIN_MATCH = 3;
|
|
@@ -22735,22 +22736,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
22735
22736
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
22736
22737
|
} catch (error) {
|
|
22737
22738
|
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
22739
|
+
const wrapped = bytes[0] === 31 && bytes[1] === 139 || bytes.length >= 2 && (bytes[0] & 15) === 8 && bytes[0] >>> 4 <= 7 && (bytes[0] << 8 | bytes[1]) % 31 === 0;
|
|
22738
22740
|
const decoder = new Inflate({
|
|
22739
|
-
raw: !
|
|
22741
|
+
raw: !wrapped,
|
|
22740
22742
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
22741
22743
|
});
|
|
22744
|
+
const chunks = [];
|
|
22742
22745
|
let length = 0;
|
|
22743
22746
|
decoder.onData = (chunk) => {
|
|
22744
22747
|
length += chunk.length;
|
|
22745
22748
|
if (length > maxDecodedBytes) {
|
|
22746
22749
|
throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
22747
22750
|
}
|
|
22748
|
-
|
|
22751
|
+
chunks.push(chunk);
|
|
22749
22752
|
};
|
|
22750
|
-
|
|
22753
|
+
const complete = decoder.push(bytes, true);
|
|
22754
|
+
const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
|
|
22755
|
+
if ((!complete || decoder.err || !decoder.ended) && !truncated) {
|
|
22751
22756
|
throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
22752
22757
|
}
|
|
22753
|
-
inflated =
|
|
22758
|
+
inflated = new Uint8Array(length);
|
|
22759
|
+
let offset = 0;
|
|
22760
|
+
for (const chunk of chunks) {
|
|
22761
|
+
inflated.set(chunk, offset);
|
|
22762
|
+
offset += chunk.length;
|
|
22763
|
+
}
|
|
22754
22764
|
}
|
|
22755
22765
|
return applyPredictor(inflated, parms);
|
|
22756
22766
|
}
|
|
@@ -35164,7 +35174,7 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
35164
35174
|
const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
|
|
35165
35175
|
const widths = /* @__PURE__ */ new Map();
|
|
35166
35176
|
let defaultWidth = 556;
|
|
35167
|
-
const isTwoByteCid = subtype === "Type0"
|
|
35177
|
+
const isTwoByteCid = subtype === "Type0";
|
|
35168
35178
|
let fontMatrix;
|
|
35169
35179
|
let charProcs;
|
|
35170
35180
|
let fontResources;
|
|
@@ -1626,9 +1626,14 @@ function createPythonShellCapability(context, options = {}) {
|
|
|
1626
1626
|
const stdout = [];
|
|
1627
1627
|
const stderr = [];
|
|
1628
1628
|
let captured = 0;
|
|
1629
|
+
let outputFailure;
|
|
1629
1630
|
const sink = (target, type) => ({ async write(chunk) {
|
|
1630
1631
|
childSignal.throwIfAborted();
|
|
1631
|
-
if (
|
|
1632
|
+
if (outputFailure) throw outputFailure;
|
|
1633
|
+
if (chunk.length > outputLimit - captured) {
|
|
1634
|
+
outputFailure = new RangeError("Python shell output limit exceeded");
|
|
1635
|
+
throw outputFailure;
|
|
1636
|
+
}
|
|
1632
1637
|
captured += chunk.length;
|
|
1633
1638
|
if (publish) {
|
|
1634
1639
|
for (let offset = 0; offset < chunk.length; offset += chunkBytes) {
|
|
@@ -1652,6 +1657,7 @@ function createPythonShellCapability(context, options = {}) {
|
|
|
1652
1657
|
externalInvocation: true
|
|
1653
1658
|
});
|
|
1654
1659
|
childSignal.throwIfAborted();
|
|
1660
|
+
if (outputFailure) throw outputFailure;
|
|
1655
1661
|
return { stdout, stderr, exitCode: result.exitCode };
|
|
1656
1662
|
} catch (error) {
|
|
1657
1663
|
if (!publish && !signal.aborted && childSignal.aborted && childSignal.reason?.name === "TimeoutError") {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/pdf-ast/src/cos/filters.ts
|
|
6
6
|
init_buffer();
|
|
7
|
-
import { deflate, Inflate } from "pako";
|
|
7
|
+
import { deflate, Inflate, Z_BUF_ERROR } from "pako";
|
|
8
8
|
|
|
9
9
|
// packages/pdf-ast/src/vendor/pdfjs-fonts.mjs
|
|
10
10
|
init_buffer();
|
|
@@ -19365,22 +19365,31 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
19365
19365
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
19366
19366
|
} catch (error) {
|
|
19367
19367
|
if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
|
|
19368
|
+
const wrapped = bytes[0] === 31 && bytes[1] === 139 || bytes.length >= 2 && (bytes[0] & 15) === 8 && bytes[0] >>> 4 <= 7 && (bytes[0] << 8 | bytes[1]) % 31 === 0;
|
|
19368
19369
|
const decoder = new Inflate({
|
|
19369
|
-
raw: !
|
|
19370
|
+
raw: !wrapped,
|
|
19370
19371
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
19371
19372
|
});
|
|
19373
|
+
const chunks = [];
|
|
19372
19374
|
let length = 0;
|
|
19373
19375
|
decoder.onData = (chunk) => {
|
|
19374
19376
|
length += chunk.length;
|
|
19375
19377
|
if (length > maxDecodedBytes) {
|
|
19376
19378
|
throw new PdfError("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
19377
19379
|
}
|
|
19378
|
-
|
|
19380
|
+
chunks.push(chunk);
|
|
19379
19381
|
};
|
|
19380
|
-
|
|
19382
|
+
const complete = decoder.push(bytes, true);
|
|
19383
|
+
const truncated = wrapped && decoder.err === Z_BUF_ERROR && length > 0;
|
|
19384
|
+
if ((!complete || decoder.err || !decoder.ended) && !truncated) {
|
|
19381
19385
|
throw new PdfError("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
19382
19386
|
}
|
|
19383
|
-
inflated =
|
|
19387
|
+
inflated = new Uint8Array(length);
|
|
19388
|
+
let offset = 0;
|
|
19389
|
+
for (const chunk of chunks) {
|
|
19390
|
+
inflated.set(chunk, offset);
|
|
19391
|
+
offset += chunk.length;
|
|
19392
|
+
}
|
|
19384
19393
|
}
|
|
19385
19394
|
return applyPredictor(inflated, parms);
|
|
19386
19395
|
}
|
|
@@ -30960,7 +30969,7 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
30960
30969
|
const glyphNames = buildFontEncodingGlyphNamesMap(encNode);
|
|
30961
30970
|
const widths = /* @__PURE__ */ new Map();
|
|
30962
30971
|
let defaultWidth = 556;
|
|
30963
|
-
const isTwoByteCid = subtype === "Type0"
|
|
30972
|
+
const isTwoByteCid = subtype === "Type0";
|
|
30964
30973
|
let fontMatrix;
|
|
30965
30974
|
let charProcs;
|
|
30966
30975
|
let fontResources;
|
|
@@ -48,11 +48,11 @@ import {
|
|
|
48
48
|
trimImage,
|
|
49
49
|
unflattenImage,
|
|
50
50
|
unpremultiplyRgbaImage
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-7JA44PVV.js";
|
|
52
52
|
import {
|
|
53
53
|
PdfDocument,
|
|
54
54
|
encodePng
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-BAUGDXLZ.js";
|
|
56
56
|
import {
|
|
57
57
|
createLuaFilterCapability
|
|
58
58
|
} from "./chunk-Y2KHC6TZ.js";
|
|
@@ -73,10 +73,15 @@ export function createPythonShellCapability(context, options = {}) {
|
|
|
73
73
|
const stdout = [];
|
|
74
74
|
const stderr = [];
|
|
75
75
|
let captured = 0;
|
|
76
|
+
let outputFailure;
|
|
76
77
|
const sink = (target, type) => ({ async write(chunk) {
|
|
77
78
|
childSignal.throwIfAborted();
|
|
78
|
-
if (
|
|
79
|
-
throw
|
|
79
|
+
if (outputFailure)
|
|
80
|
+
throw outputFailure;
|
|
81
|
+
if (chunk.length > outputLimit - captured) {
|
|
82
|
+
outputFailure = new RangeError('Python shell output limit exceeded');
|
|
83
|
+
throw outputFailure;
|
|
84
|
+
}
|
|
80
85
|
captured += chunk.length;
|
|
81
86
|
if (publish) {
|
|
82
87
|
for (let offset = 0; offset < chunk.length; offset += chunkBytes) {
|
|
@@ -97,6 +102,9 @@ export function createPythonShellCapability(context, options = {}) {
|
|
|
97
102
|
stdin: childInput, stdout: sink(stdout, 'stdout'), stderr: sink(stderr, 'stderr'), externalInvocation: true,
|
|
98
103
|
});
|
|
99
104
|
childSignal.throwIfAborted();
|
|
105
|
+
// A command may catch sink rejection and return a status; the host limit still failed.
|
|
106
|
+
if (outputFailure)
|
|
107
|
+
throw outputFailure;
|
|
100
108
|
return { stdout, stderr, exitCode: result.exitCode };
|
|
101
109
|
}
|
|
102
110
|
catch (error) {
|