fix underflow error found by fuzzing

This commit is contained in:
Jeromy 2016-05-04 10:51:57 -07:00
parent 256afede6e
commit 9e13209db1
1 changed files with 2 additions and 1 deletions

View File

@ -70,9 +70,10 @@ func validateBytes(b []byte) (err error) {
return err
}
if len(b) < size {
if len(b) < size || size < 0 {
return fmt.Errorf("invalid value for size")
}
b = b[size:]
}