From 071cbd09061fb0e519fb1216b2ddb156643b0d9e Mon Sep 17 00:00:00 2001 From: Vít Ondruch Date: Jan 08 2021 15:14:30 +0000 Subject: Rename patch to the correct name. --- diff --git a/f690eb34e28b000627e5f0649dd81a04e252286f.patch b/f690eb34e28b000627e5f0649dd81a04e252286f.patch deleted file mode 100644 index 416f85e..0000000 --- a/f690eb34e28b000627e5f0649dd81a04e252286f.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f690eb34e28b000627e5f0649dd81a04e252286f Mon Sep 17 00:00:00 2001 -From: Nobuyoshi Nakada -Date: Sat, 2 Jan 2021 12:11:52 +0900 -Subject: [PATCH] Fixed dangling imemo_tmpbuf - -The count of rb_alloc_tmp_buffer_with_count is the allocation size -counted in VALUE size but not in the requested element size. - -Co-authored-by: Yusuke Endoh -Co-authored-by: Koichi Sasada ---- - include/ruby/internal/memory.h | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h -index 974c21e19ce8..7d24df494512 100644 ---- a/include/ruby/internal/memory.h -+++ b/include/ruby/internal/memory.h -@@ -250,8 +250,9 @@ rbimpl_size_mul_or_raise(size_t x, size_t y) - static inline void * - rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize) - { -- return rb_alloc_tmp_buffer_with_count( -- store, rbimpl_size_mul_or_raise(count, elsize), count); -+ const size_t total_size = rbimpl_size_mul_or_raise(count, elsize); -+ const size_t cnt = (total_size + sizeof(VALUE) - 1) / sizeof(VALUE); -+ return rb_alloc_tmp_buffer_with_count(store, total_size, cnt); - } - - #ifndef __MINGW32__ diff --git a/ruby-3.0.0-Fixed-dangling-imemo_tmpbuf.patch b/ruby-3.0.0-Fixed-dangling-imemo_tmpbuf.patch new file mode 100644 index 0000000..416f85e --- /dev/null +++ b/ruby-3.0.0-Fixed-dangling-imemo_tmpbuf.patch @@ -0,0 +1,30 @@ +From f690eb34e28b000627e5f0649dd81a04e252286f Mon Sep 17 00:00:00 2001 +From: Nobuyoshi Nakada +Date: Sat, 2 Jan 2021 12:11:52 +0900 +Subject: [PATCH] Fixed dangling imemo_tmpbuf + +The count of rb_alloc_tmp_buffer_with_count is the allocation size +counted in VALUE size but not in the requested element size. + +Co-authored-by: Yusuke Endoh +Co-authored-by: Koichi Sasada +--- + include/ruby/internal/memory.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h +index 974c21e19ce8..7d24df494512 100644 +--- a/include/ruby/internal/memory.h ++++ b/include/ruby/internal/memory.h +@@ -250,8 +250,9 @@ rbimpl_size_mul_or_raise(size_t x, size_t y) + static inline void * + rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize) + { +- return rb_alloc_tmp_buffer_with_count( +- store, rbimpl_size_mul_or_raise(count, elsize), count); ++ const size_t total_size = rbimpl_size_mul_or_raise(count, elsize); ++ const size_t cnt = (total_size + sizeof(VALUE) - 1) / sizeof(VALUE); ++ return rb_alloc_tmp_buffer_with_count(store, total_size, cnt); + } + + #ifndef __MINGW32__