Error decoding object with large buffer
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 43/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
The report reproduces the failure with cbor.encode and cbor.decode on an object containing a large buffer, and includes a stack trace pointing to lib/decoder.js. Start by checking the decoder path around decodeFirstSync and reproduce with the supplied snippet, varying buffer size and property order. Done means the encoded object decodes correctly across the reported cases, with a regression test covering the size and ordering behavior.
由索引模型根据 Issue 内容生成。
描述
The following snippet fails with error at decode:
let buffer = fs.readFileSync('some_large_file');
buffer = buffer.slice(0, 16377);
let object = {
a: buffer,
b: 1
};
let encoded = cbor.encode(object);
let decoded = cbor.decode(encoded);
Error: Insufficient data
at Object.decodeFirstSync (/*****/node_modules/cbor/lib/decoder.js:131:15)
at /******/index.js:24:24
at Object.<anonymous> (/*****/index.js:181:1)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:159:18)
The size of buffer for which the error occurs depends on the name of the object properties a and b. That is, if the names are longer then shorter buffers produce the error.
With property names a and b, the error does not occur if I reduce the size of buffer to 16376 bytes, like:
buffer = buffer.slice(0, 16376);
The error does not occur if I switch the order of a and b in object, like:
let object = {
b: 1,
a: buffer
};
Reproduced with 2.0.0 and 3.0.0
- 主要语言
- JavaScript
- 星标
- 379
- 派生
- 73
- 平均合并
- 7 分钟
- 30 天内合并 PR
- 1
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hildjj/node-cbor 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
-
难度 3/5 1-2 天 新手友好度 58/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 42/100
-
enhancement
难度 3/5 1-2 天 新手友好度 36/100
相似的 Issue
-
enhancement ready
难度 2/5 1-3 小时 新手友好度 84/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
DCGM/semant-demo#708 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
Client codegen: an import repeated in an impl file is emitted twice, and the browser rejects the module可能已有人在做 @MalithaPrabhashana 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 64/100
jaseci-labs/jac#10756 ·
维护者通常 1 天内回复