dsh-plugin-lookatstudy 0.22.1 → 0.22.2

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.
@@ -1,11 +1,22 @@
1
1
  //#region src/vendor/inflate.ts
2
+ /** Default hard OUTPUT ceiling (audit B11): wire-side caps bound only the
3
+ * compressed bytes, but DEFLATE can expand ~1032:1 — without an output
4
+ * ceiling a crafted arXiv PDF or epub wedges the host in a synchronous
5
+ * multi-GB grow loop (the same event-loop-freeze class as the 0.22.1 TJ
6
+ * regex fix). */
7
+ const INFLATE_MAX_OUTPUT = 67108864;
2
8
  /** Growable output buffer; back-references read bytes this pass already wrote. */
3
9
  var Out = class {
10
+ maxBytes;
4
11
  buf = /* @__PURE__ */ new Uint8Array(1024);
5
12
  len = 0;
13
+ constructor(maxBytes) {
14
+ this.maxBytes = maxBytes;
15
+ }
6
16
  pushByte(b) {
17
+ if (this.len + 1 > this.maxBytes) throw new Error("inflate: 输出超过上限 (audit B11 解压炸弹护栏)");
7
18
  if (this.len === this.buf.length) {
8
- const next = new Uint8Array(this.buf.length * 2);
19
+ const next = new Uint8Array(Math.max(this.len + 1, Math.min(this.buf.length * 2, this.maxBytes)));
9
20
  next.set(this.buf);
10
21
  this.buf = next;
11
22
  }
@@ -60,7 +71,7 @@ var Huffman = class {
60
71
  count = new Array(16).fill(0);
61
72
  symbols = [];
62
73
  constructor(lengths) {
63
- for (const l of lengths) this.count[l]++;
74
+ for (let li = 0; li < lengths.length; li++) this.count[lengths[li]]++;
64
75
  this.count[0] = 0;
65
76
  const offs = new Array(16).fill(0);
66
77
  for (let len = 1; len < 16; len++) offs[len] = offs[len - 1] + this.count[len - 1];
@@ -254,10 +265,11 @@ function inflateBlock(br, out, lit, dist) {
254
265
  }
255
266
  }
256
267
  }
257
- /** Decompress a raw DEFLATE stream (zip method 8, no zlib header). Throws on truncation/corruption. */
258
- function inflateRaw(src) {
268
+ /** Decompress a raw DEFLATE stream (zip method 8, no zlib header). Throws on
269
+ * truncation/corruption and on exceeding the output ceiling. */
270
+ function inflateRaw(src, maxBytes = INFLATE_MAX_OUTPUT) {
259
271
  const br = new BitReader(src);
260
- const out = new Out();
272
+ const out = new Out(maxBytes);
261
273
  for (;;) {
262
274
  const bfinal = br.readBit();
263
275
  const btype = br.readBits(2);
@@ -299,13 +311,13 @@ function inflateRaw(src) {
299
311
  }
300
312
  }
301
313
  /** Decompress a zlib (RFC 1950) stream: 2-byte header + raw deflate (+ ignored adler32). */
302
- function inflateZlib(src) {
314
+ function inflateZlib(src, maxBytes = INFLATE_MAX_OUTPUT) {
303
315
  if (src.length < 6) throw new Error("inflate: zlib 流过短");
304
316
  const cmf = src[0], flg = src[1];
305
317
  if ((cmf & 15) !== 8) throw new Error("inflate: 非 deflate 的 zlib CM");
306
318
  if ((cmf << 8 | flg) % 31 !== 0) throw new Error("inflate: zlib 头校验失败");
307
319
  if (flg & 32) throw new Error("inflate: 预置字典不支持");
308
- return inflateRaw(src.subarray(2));
320
+ return inflateRaw(src.subarray(2), maxBytes);
309
321
  }
310
322
  //#endregion
311
323
  export { inflateZlib as n, inflateRaw as t };
@@ -1,4 +1,4 @@
1
- import { n as readZipText, t as readZip } from "./zip-reader-KnRrq0av.mjs";
1
+ import { n as readZipText, t as readZip } from "./zip-reader-BakpZwuD.mjs";
2
2
  //#region src/vendor/pptx-parser.ts
3
3
  function decodeEntities(s) {
4
4
  return s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'").replace(/&amp;/g, "&");
@@ -1,4 +1,4 @@
1
- import { t as inflateRaw } from "./inflate-DIKUrTRi.mjs";
1
+ import { t as inflateRaw } from "./inflate-C-hhR5be.mjs";
2
2
  //#region src/vendor/zip-reader.ts
3
3
  const EOCD_SIG = 101010256;
4
4
  const CEN_SIG = 33639248;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-lookatstudy",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "packageManager": "pnpm@11.7.0",
5
5
  "description": "Turn any markdown, local folder, or GitHub learning repo into a guided course inside DeepSeek Harness: gated skill-tree progression, BKT mastery tracking, SM-2 spaced repetition.",
6
6
  "type": "module",
@@ -46,7 +46,8 @@
46
46
  "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.0",
47
47
  "@deepseek-ai/dsh-tools": ">=0.1.0-rc.0",
48
48
  "@deepseek-ai/schemastery": ">=0.1.0-rc.0",
49
- "react": ">=18"
49
+ "react": ">=18",
50
+ "react-dom": ">=18"
50
51
  },
51
52
  "exports": {
52
53
  ".": {