ruby-changes:42799
From: akr <ko1@a...>
Date: Sun, 1 May 2016 23:46:16 +0900 (JST)
Subject: [ruby-changes:42799] akr:r54873 (trunk): Add a cast to avoid signed integer overflow.
akr 2016-05-02 00:42:52 +0900 (Mon, 02 May 2016) New Revision: 54873 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54873 Log: Add a cast to avoid signed integer overflow. * vm_trace.c (recalc_remove_ruby_vm_event_flags): Add a cast to avoid signed integer overflow. Modified files: trunk/ChangeLog trunk/vm_trace.c Index: vm_trace.c =================================================================== --- vm_trace.c (revision 54872) +++ vm_trace.c (revision 54873) @@ -81,7 +81,7 @@ recalc_remove_ruby_vm_event_flags(rb_eve https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L81 ruby_vm_event_flags = 0; for (i=0; i<MAX_EVENT_NUM; i++) { - if (events & (1 << i)) { + if (events & ((rb_event_flag_t)1 << i)) { ruby_event_flag_count[i]--; } ruby_vm_event_flags |= ruby_event_flag_count[i] ? (1<<i) : 0; Index: ChangeLog =================================================================== --- ChangeLog (revision 54872) +++ ChangeLog (revision 54873) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon May 2 00:41:53 2016 Tanaka Akira <akr@f...> + + * vm_trace.c (recalc_remove_ruby_vm_event_flags): Add a cast to + avoid signed integer overflow. + Mon May 2 00:06:04 2016 Tanaka Akira <akr@f...> * test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/