Skip to content

Commit

Permalink
negative array size panic
Browse files Browse the repository at this point in the history
  • Loading branch information
d4l3k committed May 3, 2018
1 parent 6260832 commit a770211
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pry/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ func (scope *Scope) Interpret(expr ast.Node) (interface{}, error) {
if !ok {
return nil, errors.Errorf("expected int; got %#v", len)
}
if lenI < 0 {
return nil, errors.Errorf("negative array size")
}
return reflect.ArrayOf(lenI, rType), nil

case *ast.MapType:
Expand Down

0 comments on commit a770211

Please sign in to comment.