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

ruby-changes:46787

From: normal <ko1@a...>
Date: Fri, 26 May 2017 16:28:28 +0900 (JST)
Subject: [ruby-changes:46787] normal:r58902 (trunk): attempt to fix rb_alloc_tmp_buffer2 for ALLOCV_N

normal	2017-05-26 16:28:23 +0900 (Fri, 26 May 2017)

  New Revision: 58902

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58902

  Log:
    attempt to fix rb_alloc_tmp_buffer2 for ALLOCV_N
    
    This is a confusing function to my arithmetic-challenged mind,
    but nobu seems alright with this.  Anyways this lets me use
    large values of elsize without segfaulting, and "make exam"
    passes.
    
    * include/ruby/ruby.h (rb_alloc_tmp_buffer2): attempt to fix
      [ruby-core:81388] [ruby-core:81391] [Bug #13595]

  Modified files:
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 58901)
+++ include/ruby/ruby.h	(revision 58902)
@@ -1611,7 +1611,7 @@ static inline void * https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1611
 rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize)
 {
     size_t cnt = (size_t)count;
-    if (elsize % sizeof(VALUE) == 0) {
+    if (elsize == sizeof(VALUE)) {
 	if (RB_UNLIKELY(cnt > LONG_MAX / sizeof(VALUE))) {
 	    ruby_malloc_size_overflow(cnt, elsize);
 	}

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

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