X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=fuzzterm.c;h=21e7b12aa5a041ace211a6cda4315b2496a29314;hb=72c3c23ebd2149ea326ad4fe7b71ac7bdefaa514;hp=f1dcb1ab698700f44465ffdfe6fa0ffccaa687dc;hpb=1a009ab2e9d9f0baa5ff98d295d4ec7afd9ff2f9;p=PuTTY.git diff --git a/fuzzterm.c b/fuzzterm.c index f1dcb1ab..21e7b12a 100644 --- a/fuzzterm.c +++ b/fuzzterm.c @@ -23,10 +23,15 @@ int main(int argc, char **argv) term = term_init(conf, &ucsdata, NULL); term_size(term, 24, 80, 10000); term->ldisc = NULL; + /* Tell american fuzzy lop that this is a good place to fork. */ +#ifdef __AFL_HAVE_MANUAL_CONTROL + __AFL_INIT(); +#endif while (!feof(stdin)) { len = fread(blk, 1, sizeof(blk), stdin); term_data(term, 0, blk, len); } + term_update(term); return 0; } @@ -36,8 +41,28 @@ int from_backend(void *frontend, int is_stderr, const char *data, int len) /* functions required by terminal.c */ void request_resize(void *frontend, int x, int y) { } -void do_text(Context a, int b, int c, wchar_t * d, int e, unsigned long f, int g) { } -void do_cursor(Context a, int b, int c, wchar_t * d, int e, unsigned long f, int g) { } +void do_text(Context ctx, int x, int y, wchar_t * text, int len, + unsigned long attr, int lattr) +{ + int i; + + printf("TEXT[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y); + for (i = 0; i < len; i++) { + printf(" %x", (unsigned)text[i]); + } + printf("\n"); +} +void do_cursor(Context ctx, int x, int y, wchar_t * text, int len, + unsigned long attr, int lattr) +{ + int i; + + printf("CURS[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y); + for (i = 0; i < len; i++) { + printf(" %x", (unsigned)text[i]); + } + printf("\n"); +} int char_width(Context ctx, int uc) { return 1; } void set_title(void *frontend, char *t) { } void set_icon(void *frontend, char *t) { } @@ -45,7 +70,11 @@ void set_sbar(void *frontend, int a, int b, int c) { } void ldisc_send(void *handle, const char *buf, int len, int interactive) {} void ldisc_echoedit_update(void *handle) {} -Context get_ctx(void *frontend) { return NULL; } +Context get_ctx(void *frontend) { + static char x; + + return &x; +} void free_ctx(Context ctx) { } void palette_set(void *frontend, int a, int b, int c, int d) { } void palette_reset(void *frontend) { } @@ -68,6 +97,7 @@ int is_iconic(void *frontend) { return 0; } void get_window_pos(void *frontend, int *x, int *y) { *x = 0; *y = 0; } void get_window_pixels(void *frontend, int *x, int *y) { *x = 0; *y = 0; } char *get_window_title(void *frontend, int icon) { return "moo"; } +int frontend_is_utf8(void *frontend) { return TRUE; } /* needed by timing.c */ void timer_change_notify(unsigned long next) { }