Example #1
0
func (f CrashGenerator) Fuzz(g *generator.Writer) error {
	nullPointer := g.NewVariable("char*", "pointer_to_nowhere")
	g.AddStatement("%s = (char*) NULL", nullPointer)
	g.AddStatement("*%s = 'H'", nullPointer)

	return nil
}
Example #2
0
func (dr DummyGenerator) Fuzz(g *generator.Writer) error {
	g.AddStatement("SkPaint p")
	g.AddStatement("p.setColor(SK_ColorRED)")
	g.AddStatement("p.setAntiAlias(true)")
	g.AddStatement("p.setStyle(SkPaint::kStroke_Style)")
	g.AddStatement("p.setStrokeWidth(10)")
	g.AddStatement("canvas->drawLine(20, 20, 100, 100, p)")
	return nil
}
Example #3
0
func (pr PathGenerator) Fuzz(g *generator.Writer) error {
	paint := g.AddPaint()
	matrix := g.AddMatrix()
	//	clip := g.AddPath()
	path := g.AddPath()

	g.AddLoop(10, true, func() {
		paint.Rand()
		matrix.Rand()

		depthLimit := generator.RandInt(1, 2)
		contourCount := generator.RandInt(1, 4)
		segmentLimit := generator.RandInt(1, 8)
		// clip.Rand(depthLimit, contourCount, segmentLimit)

		depthLimit = generator.RandInt(1, 2)
		contourCount = generator.RandInt(1, 2)
		segmentLimit = generator.RandInt(1, 2)
		path.Rand(depthLimit, contourCount, segmentLimit)

		g.AddStatement("canvas->setMatrix(%s)", matrix.Name)
		g.AddStatement("canvas->drawPath(%s,%s)", path.Name, paint.Name)

	})
	return nil
}