[Coldstuff] patch to fix segfault in regexp/match_regexp

Brad Roberts coldstuff@cold.org
Wed, 10 Apr 2002 15:21:11 -0700 (PDT)


Great.. I had looking at this on my todo list and just haven't had a
chance yet.  Can I ask you to write a new test (see genesis/tests/) that
demonstrates the bug?

Thanks,
Brad

On Wed, 10 Apr 2002 pvx@wmute.net wrote:

> Date: Wed, 10 Apr 2002 17:55:44 -0400
> From: pvx@wmute.net
> Reply-To: coldstuff@cold.org
> To: coldstuff@cold.org
> Subject: [Coldstuff] patch to fix segfault in regexp/match_regexp
>
> 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 */
> _______________________________________________
> Cold-Coldstuff mailing list
> Cold-Coldstuff@cold.org
> http://web.cold.org/mailman/listinfo/cold-coldstuff
>