aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-06-06 12:51:52 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-06-07 10:41:01 +0200
commit948dd3af445f31e056db6116c09f095933baed5f (patch)
treef0d35359cfcdfe25bb9932bf2f750bc855c3b62f /prog
parent3f04838a10346e60b9dd81f0adb47c2518486d28 (diff)
prog: remove target.StringDictionary
The linux string dictionary comes from extremely old times when we did not have proper descriptions for almost anything, and the dictionary was a quick hack to guess at least some special strings. Now we have way better descriptions and the dictionary become both unnecessary and probably even harmful.
Diffstat (limited to 'prog')
-rw-r--r--prog/rand.go10
-rw-r--r--prog/target.go4
2 files changed, 2 insertions, 12 deletions
diff --git a/prog/rand.go b/prog/rand.go
index 3112fc50a..7a035c1b2 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -323,15 +323,9 @@ func (r *randGen) randString(s *state, t *BufferType) []byte {
'/', ':', '.', ',', '-', '\'', '[', ']', '{', '}'}
buf := new(bytes.Buffer)
for r.nOutOf(3, 4) {
- switch {
- case r.nOutOf(10, 21):
- dict := r.target.StringDictionary
- if len(dict) != 0 {
- buf.WriteString(dict[r.Intn(len(dict))])
- }
- case r.nOutOf(10, 11):
+ if r.nOutOf(10, 11) {
buf.Write([]byte{punct[r.Intn(len(punct))]})
- default:
+ } else {
buf.Write([]byte{byte(r.Intn(256))})
}
}
diff --git a/prog/target.go b/prog/target.go
index 23d1ebd08..e2d4f245c 100644
--- a/prog/target.go
+++ b/prog/target.go
@@ -46,10 +46,6 @@ type Target struct {
// and optionally any calls that need to be inserted before the arg reference.
SpecialTypes map[string]func(g *Gen, typ Type, dir Dir, old Arg) (Arg, []*Call)
- // Special strings that can matter for the target.
- // Used as fallback when string type does not have own dictionary.
- StringDictionary []string
-
// Resources that play auxiliary role, but widely used throughout all syscalls (e.g. pid/uid).
AuxResources map[string]bool