[openssh-commits] [openssh] 15/20: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jan 20 00:27:59 EST 2015


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 87d5495bd337e358ad69c524fcb9495208c0750b
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Sun Jan 18 19:50:55 2015 +0000

    upstream commit
    
    better dumps from the fuzzer (shown on errors) -
     include the original data as well as the fuzzed copy.
---
 regress/unittests/test_helper/fuzz.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/regress/unittests/test_helper/fuzz.c b/regress/unittests/test_helper/fuzz.c
index 963bce3..93cff69 100644
--- a/regress/unittests/test_helper/fuzz.c
+++ b/regress/unittests/test_helper/fuzz.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: fuzz.c,v 1.5 2015/01/13 14:51:51 djm Exp $	*/
+/*	$OpenBSD: fuzz.c,v 1.6 2015/01/18 19:50:55 djm Exp $	*/
 /*
  * Copyright (c) 2011 Damien Miller <djm at mindrot.org>
  *
@@ -154,19 +154,11 @@ fuzz_fmt(struct fuzz *fuzz, char *s, size_t n)
 	}
 }
 
-void
-fuzz_dump(struct fuzz *fuzz)
+static void
+dump(u_char *p, size_t len)
 {
-	u_char *p = fuzz_ptr(fuzz);
-	size_t i, j, len = fuzz_len(fuzz);
-	char buf[256];
+	size_t i, j;
 
-	if (fuzz_fmt(fuzz, buf, sizeof(buf)) != 0) {
-		fprintf(stderr, "%s: fuzz invalid\n", __func__);
-		abort();
-	}
-	fputs(buf, stderr);
-	fprintf(stderr, "fuzz context %p len = %zu\n", fuzz, len);
 	for (i = 0; i < len; i += 16) {
 		fprintf(stderr, "%.4zd: ", i);
 		for (j = i; j < i + 16; j++) {
@@ -188,6 +180,22 @@ fuzz_dump(struct fuzz *fuzz)
 	}
 }
 
+void
+fuzz_dump(struct fuzz *fuzz)
+{
+	char buf[256];
+
+	if (fuzz_fmt(fuzz, buf, sizeof(buf)) != 0) {
+		fprintf(stderr, "%s: fuzz invalid\n", __func__);
+		abort();
+	}
+	fputs(buf, stderr);
+	fprintf(stderr, "fuzz original %p len = %zu\n", fuzz->seed, fuzz->slen);
+	dump(fuzz->seed, fuzz->slen);
+	fprintf(stderr, "fuzz context %p len = %zu\n", fuzz, fuzz_len(fuzz));
+	dump(fuzz_ptr(fuzz), fuzz_len(fuzz));
+}
+
 #ifdef SIGINFO
 static struct fuzz *last_fuzz;
 

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list