[Coldstuff] patch to fix segfault in regexp/match_regexp
coldstuff@cold.org
coldstuff@cold.org
Wed, 10 Apr 2002 17:55:44 -0400
There's a bug in Genesis 1.1.10-STABLE which causes a segfault whenenver a ColdC program attempts to evaluate an invalid regexp. The following patch should fix the problem:
diff -u Genesis-1.1.10-STABLE.old/src/strutil.c Genesis-1.1.10-STABLE/src/strutil.c
--- Genesis-1.1.10-STABLE.old/src/strutil.c Thu Jan 10 00:30:09 2002
+++ Genesis-1.1.10-STABLE/src/strutil.c Wed Apr 10 17:33:28 2002
@@ -380,7 +380,7 @@
Int i;
if ((rx = string_regexp(reg)) == NULL) {
- cthrow(regexp_id, "%s", regerror(NULL));
+ cthrow(regexp_id, "%s", gen_regerror(NULL));
*error = YES;
return NULL;
}
@@ -427,7 +427,7 @@
size;
if ((rx = string_regexp(reg)) == (regexp *) NULL) {
- cthrow(regexp_id, "%s", regerror(NULL));
+ cthrow(regexp_id, "%s", gen_regerror(NULL));
*error = YES;
return NULL;
}
@@ -579,7 +579,7 @@
/* Compile the regexp, note: it is free'd by string_discard() */
if ((rx = string_regexp(reg)) == (regexp *) NULL)
- THROW((regexp_id, "%s", regerror(NULL)))
+ THROW((regexp_id, "%s", gen_regerror(NULL)))
/* initial regexp execution */
if (!gen_regexec(rx, s, sensitive))
@@ -1029,7 +1029,7 @@
/* Compile the regexp, note: it is free'd by string_discard() */
if ((rx = string_regexp(reg)) == (regexp *) NULL)
- x_THROW((regexp_id, "%s", regerror(NULL)))
+ x_THROW((regexp_id, "%s", gen_regerror(NULL)))
/* look at the regexp and see if its a simple one,
which we can currently handle */