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

ruby-changes:68775

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:13:31 +0900 (JST)
Subject: [ruby-changes:68775] c2f6552af4 (master): Copy right number of bytes in add_incoming

https://git.ruby-lang.org/ruby.git/commit/?id=c2f6552af4

From c2f6552af40b5aa08d727085403b8928121f068a Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Thu, 11 Feb 2021 17:18:14 -0500
Subject: Copy right number of bytes in add_incoming

---
 ujit_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ujit_core.c b/ujit_core.c
index 1ed8c47a99..f52059b0ed 100644
--- a/ujit_core.c
+++ b/ujit_core.c
@@ -176,7 +176,7 @@ static void add_incoming(block_t* p_block, uint32_t branch_idx) https://github.com/ruby/ruby/blob/trunk/ujit_core.c#L176
 {
     // Add this branch to the list of incoming branches for the target
     uint32_t* new_list = malloc(sizeof(uint32_t) * (p_block->num_incoming + 1));
-    memcpy(new_list, p_block->incoming, p_block->num_incoming);
+    memcpy(new_list, p_block->incoming, sizeof(uint32_t) * p_block->num_incoming);
     new_list[p_block->num_incoming] = branch_idx;
     p_block->incoming = new_list;
     p_block->num_incoming += 1;
-- 
cgit v1.2.1


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

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