genRange crashes with ClOpen when lower bound equals upper bound
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- haskell
- Domain
- testing-qa
Research direction
Read src/Codec/CBOR/Cuddle/CBOR/Gen.hs, starting at genRange and its range helper, and reproduce the empty 5...5 case with ClOpen bounds. Validate the adjusted range before choose or antiChoose, and consider the issue resolved when empty ranges produce a clear error instead of an invalid-range crash.
Written by the indexing model from the issue text.
Description
Description
genRange can crash with an invalid choose range when the lower bound equals the upper bound and bounds are ClOpen.
Location
src/Codec/CBOR/Cuddle/CBOR/Gen.hs, genRange function
Details
When a == b and the range bound is ClOpen, the range helper computes (x, pred y), producing an upper bound strictly less than the lower bound. This causes choose/antiChoose to crash with an invalid range.
For example, a CDDL range like 5...5 (exclusive on both ends) results in an empty range that choose cannot handle.
Suggested fix
Validate that the range is non-empty after applying bounds, and emit a clear error message for empty ranges instead of crashing inside choose.
- Dominant language
- Haskell
- Stars
- 8
- Forks
- 5
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/cuddle
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
IntersectMBO/cuddle#168 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
IntersectMBO/cuddle#167 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
IntersectMBO/cuddle#223 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
IntersectMBO/cuddle#217 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
IntersectMBO/cuddle#215 ·
All issues in IntersectMBO/cuddle
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
IntersectMBO/cardano-ledger#6276 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenZeppelin/canton-contracts#92 ·
Maintainers usually reply within 1 day