oss-fuzz/projects/cel-go/fuzz_compile.go

19 lines
332 B
Go
Raw Normal View History

2021-05-12 14:23:32 +00:00
package cel
func FuzzCompile(data []byte) int {
env, err := NewEnv()
if err != nil {
panic("impossible to create env")
}
ast, issues := env.Compile(string(data))
if issues != nil && issues.Err() != nil {
return 0
}
_, err = env.Program(ast)
if err != nil {
panic("impossible to create prog from ast")
}
return 1
}