[ruby-talk:00815] Re: [BUG] Segmentation fault (latest CVS)

From: matz@... (Yukihiro Matsumoto)
Date: 1999-09-24 07:31:15 UTC
List: ruby-talk #815
Hi,

In message "[ruby-talk:00814] [BUG] Segmentation fault (latest CVS)"
    on 99/09/23, Jonathan Aseltine <aseltine@cs.umass.edu> writes:

|The following code will reproduce the bug:
|
|while gets
|    $_.gsub!(/[^\w\s]/, " %& ")
|    print $_
|end

Thank you for finding a bug!  This patch will improve the situation
hopefully.

--- /tmp/regex.c	Wed Sep 22 00:35:15 1999
+++ regex.c	Fri Sep 24 16:25:59 1999
@@ -2877,7 +2877,7 @@
 	    break;
 	  }
 	  for (j = 0,c = 0;j < (int)size; j++) {
-	    int cc = EXTRACT_MBC(&p[j*8]);
+	    unsigned int cc = EXTRACT_MBC(&p[j*8]);
 	    beg = WC2MBC1ST(cc);
 	    while (c < beg) {
 	      if (ismbchar(c))

In This Thread

Prev Next