xref: /aosp_15_r20/external/AFLplusplus/utils/afl_untracer/libtestinstr.c (revision 08b48e0b10e97b33e7b60c5b6e2243bd915777f2)
1 /*
2    american fuzzy lop++ - a trivial program to test the build
3    --------------------------------------------------------
4    Originally written by Michal Zalewski
5    Copyright 2014 Google Inc. All rights reserved.
6    Copyright 2019-2024 AFLplusplus Project. All rights reserved.
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at:
10      http://www.apache.org/licenses/LICENSE-2.0
11  */
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <string.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <fcntl.h>
20 
testinstr(char * buf,int len)21 void testinstr(char *buf, int len) {
22 
23   if (len < 1) return;
24   buf[len] = 0;
25 
26   // we support three input cases
27   if (buf[0] == '0')
28     printf("Looks like a zero to me!\n");
29   else if (buf[0] == '1')
30     printf("Pretty sure that is a one!\n");
31   else
32     printf("Neither one or zero? How quaint!\n");
33 
34 }
35 
36