[前][次][番号順一覧][スレッド一覧]

ruby-changes:18755

From: kosaki <ko1@a...>
Date: Sat, 5 Feb 2011 01:06:06 +0900 (JST)
Subject: [ruby-changes:18755] Ruby:r30781 (trunk): * vm_core.h (GetThreadPtr): use TypedData_Get_Struct() instead

kosaki	2011-02-05 01:05:40 +0900 (Sat, 05 Feb 2011)

  New Revision: 30781

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30781

  Log:
    * vm_core.h (GetThreadPtr): use TypedData_Get_Struct() instead
      CoreDataFromValue() because we need type check. Otherwise,
      type mismatch can cause segmentation fault crash.
      [ruby-core:35086] [Ruby 1.9-Bug#4367]
    
    * vm.c (thread_data_type): remove static.

  Modified files:
    trunk/ChangeLog
    trunk/vm.c
    trunk/vm_core.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30780)
+++ ChangeLog	(revision 30781)
@@ -1,3 +1,12 @@
+Sat Feb  5 00:59:54 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* vm_core.h (GetThreadPtr): use TypedData_Get_Struct() instead
+	  CoreDataFromValue() because we need type check. Otherwise,
+	  type mismatch can cause segmentation fault crash.
+	  [ruby-core:35086] [Ruby 1.9-Bug#4367]
+
+	* vm.c (thread_data_type): remove static.
+
 Fri Feb  4 19:14:27 2011  Tanaka Akira  <akr@f...>
 
 	* enc/trans/utf8_mac.trans: parenthesize macro arguments.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 30780)
+++ vm_core.h	(revision 30781)
@@ -347,8 +347,10 @@
     VALUE proc;
 } rb_block_t;
 
+extern const rb_data_type_t thread_data_type;
+
 #define GetThreadPtr(obj, ptr) \
-  GetCoreDataFromValue((obj), rb_thread_t, (ptr))
+    TypedData_Get_Struct((obj), rb_thread_t, &thread_data_type, (ptr))
 
 enum rb_thread_status {
     THREAD_TO_KILL,
Index: vm.c
===================================================================
--- vm.c	(revision 30780)
+++ vm.c	(revision 30781)
@@ -1756,7 +1756,7 @@
     }
 }
 
-static const rb_data_type_t thread_data_type = {
+const rb_data_type_t thread_data_type = {
     "VM/thread",
     {
 	rb_thread_mark,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]