Project

General

Profile

Backport #6446

Backport r35595 - Windows: FD_SET and FD_SETSIZE segv due different compilation flags

Added by luislavena (Luis Lavena) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:45111]

Description

Please backport r35595 to ruby_1_9_3 branch. It contains a SEGV fix for FD_SETSIZE/FD_SET that affects pre-compiled extensions with different FD_SETSIZE than the build Ruby.

Thank you

Associated revisions

Revision 2b8e9ece
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 35595: [Backport #6446]

    * include/ruby/win32.h (FD_SET): change function to macro.
      To avoid buffer overflow when smaller FD_SETSISE is used in ext
      libraries.

    * win32/win32.c (rb_w32_fdset): this function is not used anymore.
      But we leave this for compatibility.

    * win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
      FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
      causes SEGV.

    * test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
      above.

    * ext/-test-/win32/fd_setsize/depend: ditto.

    * ext/-test-/win32/fd_setsize/extconf.rb: ditto.

    * ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
      [ruby-core:44588] [Bug #6352]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 35783
Added by naruse (Yui NARUSE) over 7 years ago

merge revision(s) 35595: [Backport #6446]

* include/ruby/win32.h (FD_SET): change function to macro.
  To avoid buffer overflow when smaller FD_SETSISE is used in ext
  libraries.

* win32/win32.c (rb_w32_fdset): this function is not used anymore.
  But we leave this for compatibility.

* win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
  FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
  causes SEGV.

* test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
  above.

* ext/-test-/win32/fd_setsize/depend: ditto.

* ext/-test-/win32/fd_setsize/extconf.rb: ditto.

* ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
  [ruby-core:44588] [Bug #6352]

History

#1

Updated by naruse (Yui NARUSE) over 7 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35783.
Luis, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 35595: [Backport #6446]

* include/ruby/win32.h (FD_SET): change function to macro.
  To avoid buffer overflow when smaller FD_SETSISE is used in ext
  libraries.

* win32/win32.c (rb_w32_fdset): this function is not used anymore.
  But we leave this for compatibility.

* win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
  FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
  causes SEGV.

* test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
  above.

* ext/-test-/win32/fd_setsize/depend: ditto.

* ext/-test-/win32/fd_setsize/extconf.rb: ditto.

* ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
  [ruby-core:44588] [Bug #6352]

Also available in: Atom PDF