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

ruby-changes:58181

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 10 Oct 2019 00:14:37 +0900 (JST)
Subject: [ruby-changes:58181] 9b919885a0 (master): fix memory corruption in old GCC

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

From 9b919885a08d6cf3c68cb1bce992feb43a8fad0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Thu, 10 Oct 2019 00:10:14 +0900
Subject: fix memory corruption in old GCC

This typo introduced memory corruption when __builtin_add_overflow
is not available but uint128_t is.  GCC before 5 are one of such
situatins.

See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/opensuseleap/ruby-master/log/20191009T120004Z.log.html.gz

diff --git a/bootstraptest/test_insns.rb b/bootstraptest/test_insns.rb
index 3d7f964..1269d7d 100644
--- a/bootstraptest/test_insns.rb
+++ b/bootstraptest/test_insns.rb
@@ -427,7 +427,6 @@ tests.compact.each do |(insn, expr, *a)| https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L427
   end
 end
 
-
 # with trace
 tests.compact.each {|(insn, expr, *a)|
   progn = "set_trace_func(proc{})\n" + expr
diff --git a/gc.c b/gc.c
index 7cc3c53..f429237 100644
--- a/gc.c
+++ b/gc.c
@@ -135,7 +135,7 @@ size_add_overflow(size_t x, size_t y) https://github.com/ruby/ruby/blob/trunk/gc.c#L135
 
 #elif defined(DSIZE_T)
     RB_GNUC_EXTENSION DSIZE_T dx = x;
-    RB_GNUC_EXTENSION DSIZE_T dy = x;
+    RB_GNUC_EXTENSION DSIZE_T dy = y;
     RB_GNUC_EXTENSION DSIZE_T dz = dx + dy;
     p = dz > SIZE_MAX;
     z = (size_t)dz;
-- 
cgit v0.10.2


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

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