Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 2009 14:53:12 +0900 (JST)
From:      Yoshisato YANAGISAWA <osho@pcc-software.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        stas@FreeBSD.org
Subject:   ports/135533: [PATCH] lang/ruby18: fix segmentation fault in 1.8.7-p160.
Message-ID:  <200906130553.n5D5rCVJ025309@ai.pcc-software.org>
Resent-Message-ID: <200906130610.n5D6A1iA018696@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         135533
>Category:       ports
>Synopsis:       [PATCH] lang/ruby18: fix segmentation fault in 1.8.7-p160.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 13 06:10:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Yoshisato YANAGISAWA
>Release:        FreeBSD 7.2-RELEASE-p1 amd64
>Organization:
>Environment:
System: FreeBSD ai.pcc-software.org 7.2-RELEASE-p1 FreeBSD 7.2-RELEASE-p1 #25: Wed Jun 10 23:31:06 JST 2009
>Description:

Ruby 1.8.7-p160 cause segmentation fault used with tDiary.
According to http://www.hinet.mydns.jp/tdiary/?date=20090506 (in Japanese),
this problem happens in a following procedure:
1. add method to an object with "instance_eval" method.
2. make a clone of the object.
3. Call the added method in the cloned object.
   then SEGV.

Added file(s):
- files/patch-class.c

Port maintainer (stas@FreeBSD.org) is cc'd.

>How-To-Repeat:

Just execute:
ruby -ve "C=0; o=''; o.instance_eval('def m; C; end'); o.clone.m"

>Fix:

Since this problem doesn't occur in latest stable snapshot,
I pulled some code from it.

--- ruby-1.8.7.160,1.patch begins here ---
--- /usr/ports/lang/ruby18/files/patch-class.c	1970-01-01 09:00:00.000000000 +0900
+++ /tmp/ruby18/files/patch-class.c	2009-06-13 11:17:46.000000000 +0900
@@ -0,0 +1,11 @@
+--- class.c	2009-01-16 11:00:48.000000000 +0900
++++ class.c	2009-06-13 11:16:16.000000000 +0900
+@@ -153,7 +153,7 @@
+ 		data.klass = obj;
+ 		break;
+ 	      default:
+-		data.klass = 0;
++		data.klass = Qnil;
+ 		break;
+ 	    }
+ 
--- ruby-1.8.7.160,1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906130553.n5D5rCVJ025309>