This file is indexed.

/usr/share/gocode/src/github.com/tendermint/go-common/test/mutate.go is in golang-github-tendermint-go-common-dev 0~20161202~0gitf40b1b6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package test

import (
	. "github.com/tendermint/go-common"
)

// Contract: !bytes.Equal(input, output) && len(input) >= len(output)
func MutateByteSlice(bytez []byte) []byte {
	// If bytez is empty, panic
	if len(bytez) == 0 {
		panic("Cannot mutate an empty bytez")
	}

	// Copy bytez
	mBytez := make([]byte, len(bytez))
	copy(mBytez, bytez)
	bytez = mBytez

	// Try a random mutation
	switch RandInt() % 2 {
	case 0: // Mutate a single byte
		bytez[RandInt()%len(bytez)] += byte(RandInt()%255 + 1)
	case 1: // Remove an arbitrary byte
		pos := RandInt() % len(bytez)
		bytez = append(bytez[:pos], bytez[pos+1:]...)
	}
	return bytez
}