Skip to content

Commit

Permalink
syz-fuzzer: fix nil deref in deserializeInput
Browse files Browse the repository at this point in the history
We build choice table only after we received the initial corpus,
so we don't check the initial corpus in deserializeInput,
we check it later in BuildChoiceTable.
  • Loading branch information
dvyukov committed May 10, 2021
1 parent 86e1b94 commit ca87309
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion syz-fuzzer/fuzzer.go
Expand Up @@ -457,7 +457,11 @@ func (fuzzer *Fuzzer) deserializeInput(inp []byte) *prog.Prog {
if err != nil {
log.Fatalf("failed to deserialize prog: %v\n%s", err, inp)
}
fuzzer.checkDisabledCalls(p)
// We build choice table only after we received the initial corpus,
// so we don't check the initial corpus here, we check it later in BuildChoiceTable.
if fuzzer.choiceTable != nil {
fuzzer.checkDisabledCalls(p)
}
if len(p.Calls) > prog.MaxCalls {
return nil
}
Expand Down

0 comments on commit ca87309

Please sign in to comment.