tpl: add sanity check to prevent panic in seq on big nums

Fixes #1092
This commit is contained in:
bep
2015-04-30 13:25:45 +02:00
parent be190fdb0d
commit be7b830f33
2 changed files with 18 additions and 2 deletions

View File

@@ -264,10 +264,14 @@ func Seq(args ...interface{}) ([]int, error) {
}
}
// sanity check
if last < -100000 {
return nil, errors.New("size of result exeeds limit")
}
size := int(((last - first) / inc) + 1)
// sanity check
if size > 2000 {
if size <= 0 || size > 2000 {
return nil, errors.New("size of result exeeds limit")
}