Skip to content

Commit 061be54

Browse files
committed
fix: fetch input
1 parent fa7ed41 commit 061be54

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

mutator/helpers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ func (m *Mutator) getFuzzedInput(set string) string {
1818
}
1919

2020
func (m *Mutator) fetchInput(set string) string {
21+
m.mux.RLock()
22+
defer m.mux.RUnlock()
23+
2124
k := m.r.Intn(len(m.inputSets[set]))
2225
return m.inputSets[set][k]
2326
}
2427

2528
func (m *Mutator) addCorpus(set, value string) {
29+
m.mux.Lock()
30+
defer m.mux.Unlock()
31+
2632
if set == "" || value == "" {
2733
return
2834
}

mutator/mutator.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"math/rand"
66
"strings"
7+
"sync"
78
"time"
89
)
910

@@ -40,6 +41,7 @@ func NewMutator(inp, app string, runs uint, fnName string, ignoreCrashes bool, i
4041
}
4142

4243
type Mutator struct {
44+
mux sync.RWMutex
4345
fuzzIdx int
4446
runs uint
4547
baseURL string

0 commit comments

Comments
 (0)