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",
|
||||
"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); {
|
||||
nl := bytes.IndexByte(data[pos:], '\n')
|
||||
if nl == -1 {
|
||||
nl = len(data)
|
||||
nl = len(data) - 1
|
||||
} else {
|
||||
nl += pos
|
||||
}
|
||||
|
@ -22,9 +22,11 @@ mutate4()
|
||||
mutate7()
|
||||
mutate8()
|
||||
`,
|
||||
`E`,
|
||||
} {
|
||||
t.Logf("test #%v: %q", i, data)
|
||||
FuzzDeserialize([]byte(data))
|
||||
FuzzParseLog([]byte(data))
|
||||
inp := []byte(data)[:len(data):len(data)]
|
||||
FuzzDeserialize(inp)
|
||||
FuzzParseLog(inp)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user