mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
5b48686691
commit
5fa12dafa8
2 changed files with 5 additions and 5 deletions
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue