From 0205ec2ffc1828aa0dbc900eebb4dfc178656a7b Mon Sep 17 00:00:00 2001 From: magnum Date: Mon, 10 Dec 2012 02:55:26 +0100 Subject: [PATCH] Self-test "valid() killer" that unfortunately will produce a segfault instead of FAIL when it hits a bug. (Not to be committed, or perhaps we could commit it #ifdef DEBUG) --- src/formats.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/formats.c b/src/formats.c index ab67d2c..da1773e 100644 --- a/src/formats.c +++ b/src/formats.c @@ -98,6 +98,18 @@ char *fmt_self_test(struct fmt_main *format) return "prepare"; if (format->methods.valid(prepared,format) != 1) return "valid"; + + if (index == 0) { + char *killer = strdup(prepared); + int i; + + for (i = strlen(killer) - 1; i > 0; i--) { + killer[i] = 0; + format->methods.valid(killer, format); + } + MEM_FREE(killer); + } + ciphertext = format->methods.split(prepared, 0); plaintext = current->plaintext; -- 1.8.0.1