dsh-agy-link 0.6.29 → 0.6.30
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/CHANGELOG.md +10 -0
- package/dist/cli-image.mjs +5 -3
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.30 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(parser): bounded protobuf varint lengths — no more main-thread hangs (fixes #116, merges PR #117).** `readVarint()` accumulated with `val |= (byte & 0x7f) << shift`, which coerces to signed 32-bit: `2 ** 31` decoded as `-2147483648`, and six-byte lengths wrapped the shift modulo 32 (`2 ** 35 + 1` → `9`). Both length-delimited walkers only checked the upper bound, so a negative/oversized length moved the cursor backwards (observed `pos = -2064995381` on a 336-byte buffer) and the synchronous parse wedged DSH's web listener. Lengths now accumulate numerically with a safe-integer check, offsets are validated, and both outer and field-20 walkers reject any length that exceeds the remaining bytes. Four subprocess-bounded regressions cover nested overflow, six-byte wraparound, valid sibling thoughts after malformed nesting, and truncated input — the dangerous cases run in a killable child so the suite itself cannot hang. Thanks to @MorseWayne for the stack trace, synthetic reproduction and patch.
|
|
8
|
+
|
|
9
|
+
### 中文
|
|
10
|
+
|
|
11
|
+
- **修复(解析器):为 protobuf 长度 varint 加边界,避免主线程卡死(修复 #116,合并 PR #117)。** `readVarint()` 原先用 `val |= (byte & 0x7f) << shift` 累积,JS 位运算会截断成有符号 32 位:`2 ** 31` 被解成 `-2147483648`,六字节长度的 shift 还会按 32 回绕(`2 ** 35 + 1` → `9`)。两层 length-delimited walker 只检查长度上界,负长度会让游标大幅回退(现场 336 字节 buffer 上 `pos = -2064995381`),同步解析直接把 DSH web 监听器卡住。现在改为数值累积 + 安全整数校验、校验读取偏移,outer 与 field-20 两层均拒绝超过剩余字节数的长度。四条子进程有界回归覆盖多层嵌套溢出、六字节回绕、异常嵌套后仍能取到后续有效思考内容、截断输入;危险输入放在可被 kill 的子进程里,避免测试自身阻塞。感谢 @MorseWayne 提供堆栈、合成复现与补丁。
|
|
12
|
+
|
|
3
13
|
## 0.6.29 (2026-11-15)
|
|
4
14
|
|
|
5
15
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -3010,12 +3010,14 @@ function isSafeConversationId(id) {
|
|
|
3010
3010
|
//#endregion
|
|
3011
3011
|
//#region src/runtime/agy/db/extract.ts
|
|
3012
3012
|
function readVarint(b, offset) {
|
|
3013
|
+
if (!Number.isInteger(offset) || offset < 0 || offset >= b.length) return null;
|
|
3013
3014
|
let val = 0;
|
|
3014
3015
|
let shift = 0;
|
|
3015
3016
|
let pos = offset;
|
|
3016
3017
|
while (pos < b.length) {
|
|
3017
3018
|
const byte = b[pos++];
|
|
3018
|
-
val
|
|
3019
|
+
val += (byte & 127) * 2 ** shift;
|
|
3020
|
+
if (!Number.isSafeInteger(val)) return null;
|
|
3019
3021
|
shift += 7;
|
|
3020
3022
|
if ((byte & 128) === 0) return {
|
|
3021
3023
|
val,
|
|
@@ -3090,7 +3092,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
3090
3092
|
if (lenRes === null) break;
|
|
3091
3093
|
pos = lenRes.next;
|
|
3092
3094
|
const len = lenRes.val;
|
|
3093
|
-
if (
|
|
3095
|
+
if (len < 0 || len > buf.length - pos) break;
|
|
3094
3096
|
const slice = buf.subarray(pos, pos + len);
|
|
3095
3097
|
pos += len;
|
|
3096
3098
|
if (fieldNum === 20) {
|
|
@@ -3107,7 +3109,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
3107
3109
|
if (l20Res === null) break;
|
|
3108
3110
|
p20 = l20Res.next;
|
|
3109
3111
|
const l20 = l20Res.val;
|
|
3110
|
-
if (
|
|
3112
|
+
if (l20 < 0 || l20 > slice.length - p20) break;
|
|
3111
3113
|
const s20 = slice.subarray(p20, p20 + l20);
|
|
3112
3114
|
p20 += l20;
|
|
3113
3115
|
if (f20 === 3) {
|
package/dist/index.js
CHANGED
|
@@ -4855,12 +4855,14 @@ function isSafeConversationId(id) {
|
|
|
4855
4855
|
//#endregion
|
|
4856
4856
|
//#region src/runtime/agy/db/extract.ts
|
|
4857
4857
|
function readVarint(b, offset) {
|
|
4858
|
+
if (!Number.isInteger(offset) || offset < 0 || offset >= b.length) return null;
|
|
4858
4859
|
let val = 0;
|
|
4859
4860
|
let shift = 0;
|
|
4860
4861
|
let pos = offset;
|
|
4861
4862
|
while (pos < b.length) {
|
|
4862
4863
|
const byte = b[pos++];
|
|
4863
|
-
val
|
|
4864
|
+
val += (byte & 127) * 2 ** shift;
|
|
4865
|
+
if (!Number.isSafeInteger(val)) return null;
|
|
4864
4866
|
shift += 7;
|
|
4865
4867
|
if ((byte & 128) === 0) return {
|
|
4866
4868
|
val,
|
|
@@ -4935,7 +4937,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4935
4937
|
if (lenRes === null) break;
|
|
4936
4938
|
pos = lenRes.next;
|
|
4937
4939
|
const len = lenRes.val;
|
|
4938
|
-
if (
|
|
4940
|
+
if (len < 0 || len > buf.length - pos) break;
|
|
4939
4941
|
const slice = buf.subarray(pos, pos + len);
|
|
4940
4942
|
pos += len;
|
|
4941
4943
|
if (fieldNum === 20) {
|
|
@@ -4952,7 +4954,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4952
4954
|
if (l20Res === null) break;
|
|
4953
4955
|
p20 = l20Res.next;
|
|
4954
4956
|
const l20 = l20Res.val;
|
|
4955
|
-
if (
|
|
4957
|
+
if (l20 < 0 || l20 > slice.length - p20) break;
|
|
4956
4958
|
const s20 = slice.subarray(p20, p20 + l20);
|
|
4957
4959
|
p20 += l20;
|
|
4958
4960
|
if (f20 === 3) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.30",
|
|
4
4
|
"description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|