Description
make test crashes with a segfault if configure was run with pcre jit enabled.
Crash happens in rx.t, e.g. in
./msc_test "-t" "op" "-n" "rx" "-p" "" "-D" "0" "-r" "1"
Stack shows that the problem is in apache2/re_operators.c:
998 rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
999 if ((rc != 0) || (jit != 1)) {
1000 *error_msg = apr_psprintf(rule->ruleset->mp,
1001 "Rule %pp [id "%s"][file "%s"][line "%d"] - "
1002 "Execution error - "
1003 "Does not support JIT (%d)",
1004 rule,((rule->actionset != NULL)&&(rule->actionset->id != NULL)) ? rule->actionset->id : "-",
1005 rule->filename != NULL ? rule->filename : "-",
1006 rule->line_num,rc);
1007 }
The rule used here has non-null actionset, but the id is set to 0xffffffff which can't be printed with %s.
The crash can be avoided by e.g. the following patch to tests/msc_test.c:
--- msc_test.c 2012-12-29 20:22:37.515480000 +0100
+++ msc_test.c 2012-12-29 20:23:32.392925000 +0100
@@ -325,9 +325,6 @@
*errmsg = apr_psprintf(g_mp, "Failed to create rule for op "%s": %s", name, *errmsg);
return -1;
}
- if (data->rule->actionset != NULL) {
-
data->rule->actionset->id = "1";
- }
/* Create a fake variable */
data->var = (msre_var *)apr_pcalloc(g_mp, sizeof(msre_var));
Note that I don't know why the test entered the error path in line 999 above. It shouldn't crash though.