X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=fuzzterm.c;h=0da3b68dba969b648b306908780389c09818c392;hb=222c134b5f4f5397f2a15d36813286edeb3cff5e;hp=f1dcb1ab698700f44465ffdfe6fa0ffccaa687dc;hpb=1a009ab2e9d9f0baa5ff98d295d4ec7afd9ff2f9;p=PuTTY.git diff --git a/fuzzterm.c b/fuzzterm.c index f1dcb1ab..0da3b68d 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) { }