зеркало из https://github.com/github/ruby.git
The last argument of rb_rescue2() should always be (VALUE)0
* Otherwise it might segfault, since C has no idea of the type of varargs, and the C code must assume all varargs are VALUE.
This commit is contained in:
Родитель
5b48686691
Коммит
5fa12dafa8
2
eval.c
2
eval.c
|
@ -974,7 +974,7 @@ rb_rescue2(VALUE (* b_proc) (VALUE), VALUE data1,
|
|||
|
||||
/*!
|
||||
* \copydoc rb_rescue2
|
||||
* \param[in] args exception classes, terminated by 0.
|
||||
* \param[in] args exception classes, terminated by (VALUE)0.
|
||||
*/
|
||||
VALUE
|
||||
rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1,
|
||||
|
|
|
@ -181,13 +181,13 @@ namespace test_rb_rescue2 {
|
|||
test(VALUE self)
|
||||
{
|
||||
#ifdef HAVE_NULLPTR
|
||||
rb_rescue2(RUBY_METHOD_FUNC(begin), self, nullptr, self, rb_eStandardError, rb_eFatal, 0);
|
||||
rb_rescue2(begin, self, nullptr, self, rb_eStandardError, rb_eFatal, 0);
|
||||
rb_rescue2(RUBY_METHOD_FUNC(begin), self, nullptr, self, rb_eStandardError, rb_eFatal, (VALUE)0);
|
||||
rb_rescue2(begin, self, nullptr, self, rb_eStandardError, rb_eFatal, (VALUE)0);
|
||||
#endif
|
||||
|
||||
rb_rescue2(RUBY_METHOD_FUNC(begin), self, RUBY_METHOD_FUNC(rescue), self,
|
||||
rb_eStandardError, rb_eFatal, 0); // old
|
||||
return rb_rescue2(begin, self, rescue, self, rb_eStandardError, rb_eFatal, 0); // new
|
||||
rb_eStandardError, rb_eFatal, (VALUE)0); // old
|
||||
return rb_rescue2(begin, self, rescue, self, rb_eStandardError, rb_eFatal, (VALUE)0); // new
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче