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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2016-05-01 15:42:52 +00:00
Родитель de2f7416d2
Коммит 0963d96e52
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Mon May 2 00:41:53 2016 Tanaka Akira <akr@fsij.org>
* 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@fsij.org>
* test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}.

Просмотреть файл

@ -81,7 +81,7 @@ recalc_remove_ruby_vm_event_flags(rb_event_flag_t events)
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;