• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdint.h>
2 #include <stdio.h>
3 
4 #include <teken.h>
5 
dummy_bell(void * s)6 static void dummy_bell(void *s) {}
dummy_cursor(void * s,const teken_pos_t * p)7 static void dummy_cursor(void *s, const teken_pos_t *p) {}
dummy_putchar(void * s,const teken_pos_t * p,teken_char_t c,const teken_attr_t * a)8 static void dummy_putchar(void *s, const teken_pos_t *p, teken_char_t c,
9                           const teken_attr_t *a) {}
dummy_fill(void * s,const teken_rect_t * r,teken_char_t c,const teken_attr_t * a)10 static void dummy_fill(void *s, const teken_rect_t *r, teken_char_t c,
11                        const teken_attr_t *a) {}
dummy_copy(void * s,const teken_rect_t * r,const teken_pos_t * p)12 static void dummy_copy(void *s, const teken_rect_t *r, const teken_pos_t *p) {}
dummy_param(void * s,int cmd,unsigned int value)13 static void dummy_param(void *s, int cmd, unsigned int value) {}
dummy_respond(void * s,const void * buf,size_t len)14 static void dummy_respond(void *s, const void *buf, size_t len) {}
15 
16 static teken_funcs_t tf = {
17     .tf_bell = dummy_bell,
18     .tf_cursor = dummy_cursor,
19     .tf_putchar = dummy_putchar,
20     .tf_fill = dummy_fill,
21     .tf_copy = dummy_copy,
22     .tf_param = dummy_param,
23     .tf_respond = dummy_respond,
24 };
25 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)26 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
27   teken_t t = { 0 };
28   teken_init(&t, &tf, NULL);
29   teken_input(&t, data, size);
30   return 0;
31 }
32