frame decodes past the end of the input and leaves the state there
还没有人认领这个 Issue。
评估
调研方向
从暴露 c.frame 和 State 的包中的 frame 辅助函数开始;它读取声明的长度,并将缓冲区交给子解码器,而没有先检查后面是否有那么多字节。使用 State(bytes.fromhex('0501')) 和 frame(c.uint) 重现,并确认参考实现拒绝。当该输入被拒绝而不是返回 1,State.remaining 从不为负,并且语料库用例 frame-uint-length-past-the-end 与现有的 frame 测试一起通过时,即完成。
由索引模型根据 Issue 内容生成。
描述
Found by running the compact-encoding-test conformance corpus against this port.
frame decodes a frame whose announced length is longer than the bytes that follow it, and leaves the state past the end of the buffer rather than refusing:
import compact_encoding as c
s = c.State(bytes.fromhex('0501')) # a frame announcing 5 bytes, with 1 following
print(c.frame(c.uint).decode(s)) # 1
print(s.start, len(s.buffer)) # 6 2
print(s.remaining) # -4
The reference rejects these bytes. remaining going negative is the part that matters beyond the wrong answer: a later read from the same state is working from a position past the buffer, so a truncated or hostile frame corrupts everything decoded after it rather than failing where the problem is.
The corpus case is frame-uint-length-past-the-end, citing the rule frame-rejects-a-length-past-the-end: "a decoder rejects a frame announcing more bytes than follow it, rather than reading the value and leaving off past the end of the input, so 0501 is a rejection and not a 1."
Reading the value inside the announced length and rejecting what runs past it is a separate rule, frame-bounds-its-value, which this port passes.
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
holepunchto/compact-encoding-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 3/5 1-2 天 新手友好度 75/100
查看 holepunchto/compact-encoding-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
ok-oldking/ok-wuthering-waves#1785 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
healthchecks/healthchecks#1349 ·
-
deployment release-lag
难度 1/5 1 小时以内 新手友好度 68/100
nolte/kamerplanter#2374 ·
维护者通常 1 天内回复
-
bug v1 v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/python-sdk#3725 ·
维护者通常 1 天内回复
-
batchterms() drops queries without a similar() clause, misaligning results with inputs可能已有人在做 @MohammadHijjawi97 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复