ldmud-3.3.719/
ldmud-3.3.719/doc/
ldmud-3.3.719/doc/efun.de/
ldmud-3.3.719/doc/efun/
ldmud-3.3.719/doc/man/
ldmud-3.3.719/doc/other/
ldmud-3.3.719/mud/
ldmud-3.3.719/mud/heaven7/
ldmud-3.3.719/mud/lp-245/
ldmud-3.3.719/mud/lp-245/banish/
ldmud-3.3.719/mud/lp-245/doc/
ldmud-3.3.719/mud/lp-245/doc/examples/
ldmud-3.3.719/mud/lp-245/doc/sefun/
ldmud-3.3.719/mud/lp-245/log/
ldmud-3.3.719/mud/lp-245/obj/Go/
ldmud-3.3.719/mud/lp-245/players/lars/
ldmud-3.3.719/mud/lp-245/room/death/
ldmud-3.3.719/mud/lp-245/room/maze1/
ldmud-3.3.719/mud/lp-245/room/sub/
ldmud-3.3.719/mud/lp-245/secure/
ldmud-3.3.719/mud/sticklib/
ldmud-3.3.719/mud/sticklib/src/
ldmud-3.3.719/mudlib/deprecated/
ldmud-3.3.719/mudlib/uni-crasher/
ldmud-3.3.719/pkg/
ldmud-3.3.719/pkg/debugger/
ldmud-3.3.719/pkg/diff/
ldmud-3.3.719/pkg/misc/
ldmud-3.3.719/src/
ldmud-3.3.719/src/autoconf/
ldmud-3.3.719/src/ptmalloc/
ldmud-3.3.719/src/util/
ldmud-3.3.719/src/util/erq/
ldmud-3.3.719/src/util/indent/hosts/next/
ldmud-3.3.719/src/util/xerq/
ldmud-3.3.719/src/util/xerq/lpc/
ldmud-3.3.719/src/util/xerq/lpc/www/
ldmud-3.3.719/test/generic/
ldmud-3.3.719/test/inc/
ldmud-3.3.719/test/t-0000398/
ldmud-3.3.719/test/t-0000548/
ldmud-3.3.719/test/t-030925/
ldmud-3.3.719/test/t-040413/
ldmud-3.3.719/test/t-041124/
ldmud-3.3.719/test/t-language/
#include "/sys/regexp.h"
#include "/inc/base.inc"
#include "/inc/gc.inc"

// tries to regmatch some big expression, which causes the PCRE engine to
// recurse tens of thousands of times. If the recursion is not limited
// properly in respect to the stack size limit of the OS, this will crash the
// driver.
// test is implemented separately because it is supposed to crash the driver
// if it is not successful.
void try_crash()
{ 
    // use at least some of the available stack.
    if (caller_stack_depth() < __MAX_RECURSION__-10) {
        this_object()->try_crash();
        return;
    }

    catch(regmatch("aaa bbb ccc"*1000000,"a{1,2}(\n|.)+cc",
            RE_PCRE|RE_MULTILINE|RE_MATCH_SUBS,0);nolog);
    // actually, if the driver survives, the test is successful, no matter if
    // the driver was able to match it correctly (because it got plenty of
    // stack space from the OS) or raised an error.
    msg("Success\n");
    shutdown(0);
}

void run_test()
{
    msg("\nRunning test for #0000524...\n"
          "----------------------------\n");
    try_crash();
}

string *epilog(int eflag)
{
    call_out(#'run_test,0);
    return 0;
}