syzkaller/pkg/compiler/fuzz.go
Dmitry Vyukov 9fe4bdc5f1 executor: overhaul
Make as much code as possible shared between all OSes.
In particular main is now common across all OSes.
Make more code shared between executor and csource
(in particular, loop function and threaded execution logic).
Also make loop and threaded logic shared across all OSes.
Make more posix/unix code shared across OSes
(e.g. signal handling, pthread creation, etc).
Plus other changes along similar lines.
Also support test OS in executor (based on portable posix)
and add 4 arches that cover all execution modes
(fork server/no fork server, shmem/no shmem).

This change paves way for testing of executor code
and allows to preserve consistency across OSes and executor/csource.
2018-07-24 12:04:27 +02:00

26 lines
541 B
Go

// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// +build gofuzz
package compiler
import (
"github.com/google/syzkaller/pkg/ast"
)
func Fuzz(data []byte) int {
eh := func(pos ast.Pos, msg string) {}
desc := ast.Parse(data, "", eh)
if desc == nil {
return 0
}
prog := Compile(desc, fuzzConsts, eh)
if prog == nil {
return 0
}
return 1
}
var fuzzConsts = map[string]uint64{"A": 1, "B": 2, "C": 3, "SYS_C": 4}