panic: runtime error: slice bounds out of range [808:773]
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 12.4k
- Forks
- 510
- PR merge metrics
- No merged PRs in 30d
Description
This panic happens when using the slicer toxic:
panic: runtime error: slice bounds out of range [808:773]
goroutine 114 [running]:
github.com/Shopify/toxiproxy/v2/toxics.(*SlicerToxic).Pipe(0x1400020c0f0, 0x1400021e480)
github.com/Shopify/toxiproxy/v2/toxics/slicer.go:65 +0x320
github.com/Shopify/toxiproxy/v2/toxics.(*ToxicStub).Run(0x1400021e480, 0x14000210d20)
github.com/Shopify/toxiproxy/v2/toxics/toxic.go:86 +0xb8
created by github.com/Shopify/toxiproxy/v2.(*ToxicLink).Start in goroutine 58
github.com/Shopify/toxiproxy/v2/link.go:109 +0x2c8
The bug is here:
https://github.com/Shopify/toxiproxy/blob/7abcb6f9cf95d2fb27244435e22b16bda14ab5c3/toxics/slicer.go#L42-L44
rand.Intn can return a number in [0, SizeVariation*2), so it can be less than SizeVariation, resulting a negative RHS and a mid less than start
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start at toxics/slicer.go lines 42-44 and follow SlicerToxic.Pipe at line 65, using the panic trace to understand the invalid slice bounds. Exercise the slicer toxic with a variation that can produce the reported range, then verify the panic no longer occurs and regression coverage captures the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100