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
- 平均合併
- 4 天 6 小時
- 30 天內合併 PR
- 1
環境準備
這個專案沒有提供開發容器、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
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog check可能已有人在做 @ocelotl 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 82/100
open-telemetry/opentelemetry-python#5825 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
cuga-project/cuga-agent#1020 ·
維護者通常 2 天內回覆
-
難度 1/5 1 小時以內 新手友好度 70/100
microsoft/playwright#43640 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆