autocomplete: prevent slice bounds panic#196
Merged
DaanHoogland merged 1 commit intoapache:mainfrom Nov 27, 2025
Merged
Conversation
Fixes apache#195 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
✅ Build complete for PR #196. 🔗 Download the cmk binaries (expires on October 17, 2025) |
hsato03
approved these changes
Nov 13, 2025
Contributor
hsato03
left a comment
There was a problem hiding this comment.
LGTM.
I was able to reproduce the issue in the autocomplete of the id field in the listAccounts API.
Apache CloudStack 🐵 CloudMonkey 6.5.0
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues
panic: runtime error: slice bounds out of range [:30] with capacity 8
goroutine 35 [running]:
github.com/chzyer/readline.(*opCompleter).truncateBufferAfterLastEqual(0xc000191340, {0xc0015e6560, 0x7, 0x8})
/home/shwstppr/lab/shapeblue/cloudstack-cloudmonkey/vendor/github.com/chzyer/readline/complete.go:54 +0x1e9
github.com/chzyer/readline.(*opCompleter).writeRunes(0xc000191340, {0xc0015e6540, 0x10000c0016ebc28?, 0x10})
/home/shwstppr/lab/shapeblue/cloudstack-cloudmonkey/vendor/github.com/chzyer/readline/complete.go:70 +0x8d
github.com/chzyer/readline.(*opCompleter).OnComplete(0xc000191340)
/home/shwstppr/lab/shapeblue/cloudstack-cloudmonkey/vendor/github.com/chzyer/readline/complete.go:125 +0x1b2
github.com/chzyer/readline.(*Operation).ioloop(0xc000191260)
/home/shwstppr/lab/shapeblue/cloudstack-cloudmonkey/vendor/github.com/chzyer/readline/operation.go:180 +0xd0f
created by github.com/chzyer/readline.NewOperation in goroutine 1
/home/shwstppr/lab/shapeblue/cloudstack-cloudmonkey/vendor/github.com/chzyer/readline/operation.go:88 +0x2c6
When attempting to reproduce the problem with the cmk binaries from PR, the panic no longer occurs.
Contributor
|
@shwstppr , more work needed here? |
Contributor
Author
|
@DaanHoogland should be good to go. Marked it ready |
DaanHoogland
approved these changes
Nov 27, 2025
Contributor
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, went back and forth through a zone id to try and reproduce the error that I could in the released 0.6.0 version, to no avail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #195