mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 03:19:51 +00:00
prog: fix out-of-bounds access
ParseLog can access data out-of-bounds. Fix that and fix regression fuzz tests to catch this.
This commit is contained in:
parent
3b37734422
commit
7c7ded697e
@ -372,6 +372,6 @@ func TestFuzz(t *testing.T) {
|
|||||||
"cleaned vnod\re",
|
"cleaned vnod\re",
|
||||||
"kernel\r:",
|
"kernel\r:",
|
||||||
} {
|
} {
|
||||||
Fuzz([]byte(data))
|
Fuzz([]byte(data)[:len(data):len(data)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func (target *Target) ParseLog(data []byte) []*LogEntry {
|
|||||||
for pos := 0; pos < len(data); {
|
for pos := 0; pos < len(data); {
|
||||||
nl := bytes.IndexByte(data[pos:], '\n')
|
nl := bytes.IndexByte(data[pos:], '\n')
|
||||||
if nl == -1 {
|
if nl == -1 {
|
||||||
nl = len(data)
|
nl = len(data) - 1
|
||||||
} else {
|
} else {
|
||||||
nl += pos
|
nl += pos
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,11 @@ mutate4()
|
|||||||
mutate7()
|
mutate7()
|
||||||
mutate8()
|
mutate8()
|
||||||
`,
|
`,
|
||||||
|
`E`,
|
||||||
} {
|
} {
|
||||||
t.Logf("test #%v: %q", i, data)
|
t.Logf("test #%v: %q", i, data)
|
||||||
FuzzDeserialize([]byte(data))
|
inp := []byte(data)[:len(data):len(data)]
|
||||||
FuzzParseLog([]byte(data))
|
FuzzDeserialize(inp)
|
||||||
|
FuzzParseLog(inp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user