From: KOSAKI Motohiro Date: 2011-09-14T12:11:44+09:00 Subject: [ruby-core:39538] Re: [Ruby 1.9 - Bug #5306] Application Hangs Due to Recent rb_thread_select Changes 2011/9/13 Eric Wong : > Motohiro KOSAKI wrote: >> File old_thread_select.patch added >> >> > static void >> > rb_fd_rcopy(fd_set *dst, rb_fdset_t *src) >> > { >> > � � size_t size = howmany(rb_fd_max(src), NFDBITS) * sizeof(fd_mask); >> > � � if (size < sizeof(fd_set)) size = sizeof(fd_set); >> > � � memcpy(dst, rb_fd_ptr(src), size); >> > } >> >> If size > sizeof(fd_set), this code makes memory corruption. > > I just thought of this again and think rb_bug() is better than > rb_raise() here. �While unlikely to hit either case, rb_raise() > will leak memory since the rb_fd_term() call gets skipped. It's a option. However I'll keep this because current one can handle an error by caller. but rb_bug() is more catastrophic. Anyway, current caller never hit this arugment check. therefore this is nitpick and no worth to change 193 IMHO.