Project

General

Profile

Bug #10727

Segfault with newlines + multibyte characters in exception message

Added by eagletmt (Kohei Suzuki) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
[ruby-core:67473]

Description

In Ruby 2.2.0, this simple Ruby script results in segfault.

class E < StandardError
  def initialize
    super("にほんご\n改行")
  end
end

raise E

It's caused by r48637.

Associated revisions

Revision 27c679b8
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

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

Revision 49201
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Revision 49201
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Revision 49201
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Revision 49201
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Revision 49201
Added by usa (Usaku NAKAMURA) almost 5 years ago

  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Revision 54f1d71a
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

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

Revision 49203
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

Revision 49203
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

Revision 49203
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

Revision 49203
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

Revision 49203
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

test for [ruby-core:67473] [Bug #10727]

Revision 6c4e9b2b
Added by naruse (Yui NARUSE) almost 5 years ago

merge revision(s) 49201,49203: [Backport #10727]

    * eval_error.c (error_print): pos and len parameters of rb_str_substr()
      are counted by characters, not bytes.  use rb_str_subseq() instead.
      [Bug #10727] [ruby-core:67473]

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

Revision 49298
Added by naruse (Yui NARUSE) almost 5 years ago

merge revision(s) 49201,49203: [Backport #10727]

* eval_error.c (error_print): pos and len parameters of rb_str_substr()
  are counted by characters, not bytes.  use rb_str_subseq() instead.
  [Bug #10727] [ruby-core:67473]

History

Updated by hsbt (Hiroshi SHIBATA) almost 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

I can reproduce this.

% ruby -v issue10727.rb
issue10727.rb:7:in `<main>': にほんご (E)
issue10727.rb: [BUG] Segmentation fault at 0x00000000000008
ruby 2.3.0dev (2015-01-09 trunk 49195) [x86_64-darwin13]

Updated by usa (Usaku NAKAMURA) almost 5 years ago

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

Applied in changeset r49201.


  • eval_error.c (error_print): pos and len parameters of rb_str_substr() are counted by characters, not bytes. use rb_str_subseq() instead. [Bug #10727] [ruby-core:67473]

Updated by usa (Usaku NAKAMURA) almost 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED

Updated by naruse (Yui NARUSE) almost 5 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

ruby_2_2 r49298 merged revision(s) 49201,49203.

Also available in: Atom PDF