Bug #3489
closedavoid NULL dereference upon failed realloc
Description
=begin
There are two uses of realloc in thread.c, neither of which handles
the case in which realloc returns NULL.
Since these functions return void, the only solution appears to be to use xrealloc.
That appears to be consistent, since the similar function, rb_fd_set, in the same
file already uses xrealloc. I've attached the patch.
Sun Jun 27 22:58:36 2010 Jim Meyering meyering@redhat.com
avoid NULL dereference upon failed realloc
* thread.c (rb_fd_resize): Use xrealloc, not realloc.
* thread.c (rb_fd_copy): Likewise.
=end
Files
Updated by mame (Yusuke Endoh) over 14 years ago
- Status changed from Open to Assigned
- Assignee set to usa (Usaku NAKAMURA)
=begin
Hi,
rb_fd_resize may be called without GVL.
Ko1 said Usaku may be able to determine whether or not this patch is ok.
Usaku, what do you think? If you have no idea or objection, I'll import
this patch.
--
Yusuke Endoh mame@tsg.ne.jp
=end
Updated by usa (Usaku NAKAMURA) over 14 years ago
- Assignee changed from usa (Usaku NAKAMURA) to akr (Akira Tanaka)
=begin
This patch is for Unix, not for Windows.
So I cannot determine and test it.
I believe that akr-san (the original author) knows the reason
and the influence.
=end
Updated by usa (Usaku NAKAMURA) over 14 years ago
=begin
FYI:
I recalled the discussion before.
As for the conclusion of the discussion, x*alloc() should run w/o GVL.
And current implementation follows the conclusion.
=end
Updated by mame (Yusuke Endoh) over 14 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r28457.
Jim, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end