Project

General

Profile

Bug #14150

ruby 2.5.0dev SEGV by rb_external_str_new_with_enc(NULL, 0, rb_usascii_encoding())

Added by kubo (Takehiro Kubo) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-12-02 trunk 60975) [x86_64-linux]
[ruby-core:84055]

Description

rb_external_str_new_with_enc(NULL, 0, rb_usascii_encoding()) gets segmentation fault in ruby 2.5.0-preview1 and ruby 2.5.0dev.
It returns an empty string in released versions.

I made test code which calls following functions.

  1. rb_str_new(NULL, 0);
  2. rb_external_str_new(NULL, 0);
  3. rb_locale_str_new(NULL, 0);
  4. rb_usascii_str_new(NULL, 0);
  5. rb_utf8_str_new(NULL, 0);
  6. rb_enc_str_new(NULL, 0, rb_usascii_encoding());
  7. rb_external_str_new_with_enc(NULL, 0, rb_usascii_encoding());

The first 6 worked fine but the last only failed.


Files

extconf.rb (49 Bytes) extconf.rb kubo (Takehiro Kubo), 12/02/2017 01:55 AM
str_new_funcs.c (809 Bytes) str_new_funcs.c kubo (Takehiro Kubo), 12/02/2017 02:11 AM

Associated revisions

Revision a1692f7f
Added by nobu (Nobuyoshi Nakada) over 1 year ago

string.c: fix rb_external_str_new_with_enc

  • string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150]

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

Revision 60979
Added by nobu (Nobuyoshi Nakada) over 1 year ago

string.c: fix rb_external_str_new_with_enc

  • string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150]

Revision 60979
Added by nobu (Nobuyoshi Nakada) over 1 year ago

string.c: fix rb_external_str_new_with_enc

  • string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150]

Revision 60979
Added by nobu (Nobuyoshi Nakada) over 1 year ago

string.c: fix rb_external_str_new_with_enc

  • string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60979.


string.c: fix rb_external_str_new_with_enc

  • string.c (rb_external_str_new_with_enc): do not search non-ascii by NULL pointer. [ruby-core:84055] [Bug #14150]

Also available in: Atom PDF