Overflow bugs in takeR, dropR, splitAtR
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
Research direction
The issue points to containers/src/Data/Sequence/Internal.hs lines 3833–3839, where takeR, dropR, and splitAtR are defined. Read those definitions and check the supplied splitAtR examples with very large negative indices; done means all three functions handle the overflow case correctly. A linked open pull request (#1268) is already addressing this issue.
Written by the indexing model from the issue text.
Description
These recently added functions are defined like
and the length xs - i can overflow if someone supplies a very large negative i.
λ> Seq.splitAtR (negate maxBound + 1) (Seq.singleton ()) -- this is fine, (1 + maxBound - 1) fits
(fromList [()],fromList [])
λ> Seq.splitAtR (negate maxBound) (Seq.singleton ()) -- (1 + maxBound) overflows, result should be same as above
(fromList [],fromList [()])
Noticed this while working on #83. I will put up a fix in a bit.
- Dominant language
- Haskell
- Stars
- 356
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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 haskell/containers
-
major-release strictness Tree
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
haskell/containers#1260 ·
-
Seq strictness
Difficulty 3/5 1-2 days Newbie friendliness 48/100
haskell/containers#1270 · 1 comment ·
-
pitfall Seq
Difficulty 4/5 1-2 days Newbie friendliness 48/100
haskell/containers#1269 ·
-
feature-request Seq
Difficulty 5/5 Over a week Newbie friendliness 35/100
haskell/containers#1266 · 12 comments · 1 reaction ·
-
IntMap IntSet Map performance
Difficulty 4/5 3-5 days Newbie friendliness 45/100
haskell/containers#1265 · 3 comments ·
All issues in haskell/containers
Similar issues
-
`unsafeReleaseAll` throws `ResourceRegistryUsedFromUntrackedThread` when called from an untracked threadPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
CLI Console from CDN: Raw SQL always creates a migration, ignoring "This is a migration" checkboxOpenk/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hasura/graphql-engine#10897 · 2 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Vim-mode indent crashes: monaco-vim's browser build inlines monaco-editor 0.33Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
compiler-explorer/compiler-explorer#9402 ·
Maintainers usually reply within 1 day