Issue #14150 has been reported by kubo (Takehiro Kubo).

----------------------------------------
Bug #14150: ruby 2.5.0dev SEGV by rb_external_str_new_with_enc(NULL, 0, rb_usascii_encoding())
https://bugs.ruby-lang.org/issues/14150

* Author: kubo (Takehiro Kubo)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-12-02 trunk 60975) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
`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)
str_new_funcs.c (809 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>