Skip to content
Permalink
Browse files

2.45b

  • Loading branch information...
thomas-huet committed Jul 29, 2017
1 parent a1d2c39 commit 2cf19246e34676de887885380248fb07c5499ab1
Showing with 72 additions and 7 deletions.
  1. +3 −3 afl-fuzz.c
  2. +2 −0 afl-gcc.c
  3. +1 −1 afl-showmap.c
  4. +1 −1 config.h
  5. +11 −0 docs/ChangeLog
  6. +1 −1 docs/README
  7. +2 −1 libtokencap/README.tokencap
  8. +51 −0 libtokencap/libtokencap.so.c
@@ -3310,10 +3310,10 @@ static u32 find_start_position(void) {
i = read(fd, tmp, sizeof(tmp) - 1); (void)i; /* Ignore errors */
close(fd);

off = strstr(tmp, "cur_path : ");
off = strstr(tmp, "cur_path : ");
if (!off) return 0;

ret = atoi(off + 17);
ret = atoi(off + 20);
if (ret >= queued_paths) ret = 0;
return ret;

@@ -3401,7 +3401,7 @@ static void write_stats_file(double bitmap_cvg, double stability, double eps) {
"paths_found : %u\n"
"paths_imported : %u\n"
"max_depth : %u\n"
"cur_path : %u\n"
"cur_path : %u\n" /* Must match find_start_position() */
"pending_favs : %u\n"
"pending_total : %u\n"
"variable_paths : %u\n"
@@ -287,6 +287,8 @@ static void edit_params(u32 argc, char** argv) {
cc_params[cc_par_cnt++] = "-fno-builtin-strcasecmp";
cc_params[cc_par_cnt++] = "-fno-builtin-strncasecmp";
cc_params[cc_par_cnt++] = "-fno-builtin-memcmp";
cc_params[cc_par_cnt++] = "-fno-builtin-strstr";
cc_params[cc_par_cnt++] = "-fno-builtin-strcasestr";

}

@@ -286,7 +286,7 @@ static void run_target(char** argv) {

}

if (keep_cores) r.rlim_max = r.rlim_cur = 0;
if (!keep_cores) r.rlim_max = r.rlim_cur = 0;
else r.rlim_max = r.rlim_cur = RLIM_INFINITY;

setrlimit(RLIMIT_CORE, &r); /* Ignore errors */
@@ -21,7 +21,7 @@

/* Version string: */

#define VERSION "2.44b"
#define VERSION "2.45b"

/******************************************************
* *
@@ -16,6 +16,17 @@ Not sure if you should upgrade? The lowest currently recommended version
is 2.41b. If you're stuck on an earlier release, it's strongly advisable
to get on with the times.

--------------
Version 2.45b:
--------------

- Added strstr, strcasestr support to libtokencap. Contributed by
Daniel Hodson.

- Fixed a resumption offset glitch spotted by Jakub Wilk.

- There are definitely no bugs in afl-showmap -c now.

--------------
Version 2.44b:
--------------
@@ -482,7 +482,7 @@ bug reports, or patches from:
Joshua J. Drake Toby Hutton
Rene Freingruber Sergey Davidoff
Sami Liedes Craig Young
Andrzej Jackowski
Andrzej Jackowski Daniel Hodson

Thank you!

@@ -32,7 +32,8 @@ part without mucking with CFLAGS in Makefiles, you can set AFL_NO_BUILTIN=1
when using afl-gcc. This setting specifically adds the following flags:

-fno-builtin-strcmp -fno-builtin-strncmp -fno-builtin-strcasecmp
-fno-builtin-strcasencmp -fno-builtin-memcmp
-fno-builtin-strcasencmp -fno-builtin-memcmp -fno-builtin-strstr
-fno-builtin-strcasestr

The next step is simply loading this library via LD_PRELOAD. The optimal usage
pattern is to allow afl-fuzz to fuzz normally for a while and build up a corpus,
@@ -241,6 +241,57 @@ int memcmp(const void* mem1, const void* mem2, size_t len) {
}


#undef strstr

const char* strstr(const char* haystack, const char* needle) {

if (__tokencap_is_ro(haystack))
__tokencap_dump(haystack, strlen(haystack), 1);

if (__tokencap_is_ro(needle))
__tokencap_dump(needle, strlen(needle), 1);

do {
const char* n = needle;
const char* h = haystack;

while(*n && *h && *n == *h) n++, h++;

if(!*n) return haystack;

} while (*(haystack++));

return 0;

}


#undef strcasestr

const char* strcasestr(const char* haystack, const char* needle) {

if (__tokencap_is_ro(haystack))
__tokencap_dump(haystack, strlen(haystack), 1);

if (__tokencap_is_ro(needle))
__tokencap_dump(needle, strlen(needle), 1);

do {

const char* n = needle;
const char* h = haystack;

while(*n && *h && tolower(*n) == tolower(*h)) n++, h++;

if(!*n) return haystack;

} while(*(haystack++));

return 0;

}


/* Init code to open the output file (or default to stderr). */

__attribute__((constructor)) void __tokencap_init(void) {

0 comments on commit 2cf1924

Please sign in to comment.
You can’t perform that action at this time.