Skip to content

fix(builtin): reject negative count in take#965

Open
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:take-negative-count
Open

fix(builtin): reject negative count in take#965
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:take-negative-count

Conversation

@netliomax25-code
Copy link
Copy Markdown

take([1,2,3], -1) surfaces a raw reflect.Value.Slice "slice index
out of bounds" runtime error. The negative count skips the > v.Len()
clamp and reaches v.Slice(0, -1) unmodified. Reject n < 0 the same
way repeat does and return a descriptive error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant