Project

General

Profile

Actions

Bug #3489

closed

avoid NULL dereference upon failed realloc

Added by meyering (Jim Meyering) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-06-27 trunk 28450) [x86_64-linux]
Backport:

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

avoid NULL dereference upon failed realloc
* thread.c (rb_fd_resize): Use xrealloc, not realloc.
* thread.c (rb_fd_copy): Likewise.

=end


Files

thread-NULL-deref.patch (1.06 KB) thread-NULL-deref.patch patch meyering (Jim Meyering), 06/27/2010 11:14 PM
Actions #1

Updated by mame (Yusuke Endoh) almost 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
=end

Actions #2

Updated by usa (Usaku NAKAMURA) almost 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

Actions #3

Updated by usa (Usaku NAKAMURA) almost 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

Actions #4

Updated by mame (Yusuke Endoh) over 13 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0