Backport #6853
closed
Added by zhangb (Bushi Zhang) over 11 years ago.
Updated over 11 years ago.
Description
I'm getting a seg fault with the following code:
resources :products, :only => %w(show) do
collection do
get ':user_platform/:app_guid(/:template)', :action => 'index', :as => '',
:defaults => { :template => 'appwall' },
:constraints => { :user_platform => /[a-z][a-z0-9-\s]+/i, :app_guid => /[0-9a-z-.]+/i }
end
end
The culprit is the line with :constraints, specifically the trailing '-' in user_platform.
I tested the expression on Rubular and it's not a problem. Older versions of ruby will return a warning but won't crash. Removing the '-' fixes the problem.
Files
Kindly ignore the rails code.
The problem is in:
/[a-z][a-z0-9-\s]+/i
- ruby -v changed from ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] to ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
$ ruby -ve 'p /[a-z][a-z0-9-\s]+/i === "abcdef"'
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
-e:1: warning: ambiguous first argument; put parentheses or even spaces
-e:1: warning: character class has '-' without escape: /[a-z][a-z0-9-\s]+/
ruby: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
trunk seems fine, so please wait next 1.9.3 patch release.
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport193
- Status changed from Open to Assigned
- Assignee set to usa (Usaku NAKAMURA)
Usa-san, please pick out the patch for this issue from trunk!
--
Yusuke Endoh mame@tsg.ne.jp
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r37172.
Bushi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 37171:
* test/ruby/test_regexp.rb
(TestRegexp#test_raw_hyphen_and_type_char_after_range): added new
test. ref [ruby-core:47115] [Backport #6853]
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0