Skip to content
Permalink
Browse files

prog: fix crash in blob mutation

If we deserialized a huge blob (larger than max blob size),
then we can get a negative size in the "Insert random bytes" case at:

		if r := int(maxLen) - len(data); n > r {
			n = r
		}

Don't insert bytes if data is already larger than maxLen.
  • Loading branch information...
dvyukov committed Jul 26, 2019
1 parent cf49ed5 commit 3e5d1beb82bfcac82b760b0113b14c891284070f
Showing with 1 addition and 1 deletion.
  1. +1 −1 prog/mutation.go
@@ -465,7 +465,7 @@ var mutateDataFuncs = [...]func(r *randGen, data []byte, minLen, maxLen uint64)
},
// Insert random bytes.
func(r *randGen, data []byte, minLen, maxLen uint64) ([]byte, bool) {
if len(data) == 0 {
if len(data) == 0 || uint64(len(data)) >= maxLen {
return data, false
}
n := r.Intn(16) + 1

0 comments on commit 3e5d1be

Please sign in to comment.
You can’t perform that action at this time.