genControl .lt crashes when controller literal is 0
还没有人认领这个 Issue。
评估
调研方向
打开 src/Codec/CBOR/Cuddle/CBOR/Gen.hs 并从 genControl 开始,重点关注 PTUInt 的 CtlOp.Lt 情况。复现 controller-literal-0 输入,然后验证它会报告清晰的空范围错误,而不是崩溃,同时现有的生成行为保持不变。
由索引模型根据 Issue 内容生成。
描述
Description
genControl crashes when the .lt operator is used with a controller literal of 0, because choose receives an invalid range.
Location
src/Codec/CBOR/Cuddle/CBOR/Gen.hs, genControl function
Details
(CtlOp.Lt, CTree.Literal (Value (VUInt n) _)) -> case target of
CTree.Postlude PTUInt -> S . TInteger <$> choose (0, fromIntegral n - 1)
When n == 0, choose (0, fromIntegral n - 1) becomes choose (0, -1), which is an invalid range.
Suggested fix
Handle n == 0 explicitly with a clear error message about the empty range (there are no unsigned integers less than 0).
- 主要语言
- Haskell
- 星标
- 8
- 派生
- 5
- 平均合并
- 3 天 12 小时
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IntersectMBO/cuddle 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
IntersectMBO/cuddle#167 ·
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
IntersectMBO/cuddle#166 ·
-
难度 4/5 3-5 天 新手友好度 43/100
IntersectMBO/cuddle#223 ·
-
难度 4/5 3-5 天 新手友好度 48/100
IntersectMBO/cuddle#217 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
IntersectMBO/cuddle#215 ·
查看 IntersectMBO/cuddle 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 76/100
bittide/bittide-hardware#1357 ·
-
难度 1/5 1 小时以内 新手友好度 76/100
wireapp/wire-server#5690 ·
维护者通常 3 天内回复
-
bug dependencies
难度 2/5 1-3 小时 新手友好度 70/100
alunduil/network-arbitrary#251 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
`logProbability` returns `NaN` for the Poisson distribution with `λ = 0`可能已有人在做 @youqad 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
haskell/statistics#235 ·