Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for byteSliceInsertRandomBytes (0.3 sec)

  1. src/internal/fuzz/mutators_byteslice_test.go

    		expected []byte
    	}{
    		{
    			name:     "byteSliceRemoveBytes",
    			mutator:  byteSliceRemoveBytes,
    			input:    []byte{1, 2, 3, 4},
    			expected: []byte{4},
    		},
    		{
    			name:     "byteSliceInsertRandomBytes",
    			mutator:  byteSliceInsertRandomBytes,
    			input:    make([]byte, 4, 8),
    			expected: []byte{3, 4, 5, 0, 0, 0, 0},
    		},
    		{
    			name:     "byteSliceDuplicateBytes",
    			mutator:  byteSliceDuplicateBytes,
    Registered: 2024-06-12 16:32
    - Last Modified: 2021-11-19 18:23
    - 4.3K bytes
    - Viewed (0)
  2. src/internal/fuzz/mutators_byteslice.go

    	}
    	pos0 := m.rand(len(b))
    	pos1 := pos0 + m.chooseLen(len(b)-pos0)
    	copy(b[pos0:], b[pos1:])
    	b = b[:len(b)-(pos1-pos0)]
    	return b
    }
    
    // byteSliceInsertRandomBytes inserts a chunk of random bytes into b at a random
    // position.
    func byteSliceInsertRandomBytes(m *mutator, b []byte) []byte {
    	pos := m.rand(len(b) + 1)
    	n := m.chooseLen(1024)
    	if len(b)+n >= cap(b) {
    		return nil
    	}
    	b = b[:len(b)+n]
    Registered: 2024-06-12 16:32
    - Last Modified: 2021-11-19 18:23
    - 7.7K bytes
    - Viewed (0)
  3. src/internal/fuzz/mutator.go

    			}
    			v /= float64(1 + m.rand(10))
    			return v
    		}
    	}
    }
    
    type byteSliceMutator func(*mutator, []byte) []byte
    
    var byteSliceMutators = []byteSliceMutator{
    	byteSliceRemoveBytes,
    	byteSliceInsertRandomBytes,
    	byteSliceDuplicateBytes,
    	byteSliceOverwriteBytes,
    	byteSliceBitFlip,
    	byteSliceXORByte,
    	byteSliceSwapByte,
    	byteSliceArithmeticUint8,
    	byteSliceArithmeticUint16,
    	byteSliceArithmeticUint32,
    Registered: 2024-06-12 16:32
    - Last Modified: 2023-09-18 20:01
    - 6.6K bytes
    - Viewed (0)
Back to top