Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Regex character class crash #2003

Closed
wjessop opened this Issue · 3 comments

2 participants

@wjessop

MRI 1.9.3: works OK
rbx 1.8: Raises RegexpError
rbx 1.9: rbx crashes

Full output:

https://gist.github.com/4051146

Summary:

$ rbx -e '"anything".match /[^\u{20}-\u{7E}]/'
Fatal ONIG error: empty range in char class
Assertion failed: (err == ONIG_NORMAL), function maybe_recompile, file vm/builtin/regexp.cpp, line 236.

@brixen
Owner

@wjessop thanks for tracking this down. The regexp is invalid in Ruby 1.8. I'll fix Rubinius 1.9 mode, though.

@brixen
Owner

@wjessop any chance I could see the actual code for this? The example works fine in a script. It fails in a -e because we were not setting the encoding of the string read from ARGV apparently.

@wjessop

If you put '# encoding: utf-8' at the beginning of the file rbx crashes:

# encoding: utf-8
"anything".match /[^\u{20}-\u{7E}]/

The original code is found here:

https://github.com/threedaymonk/htmlentities/blob/master/lib/htmlentities/encoder.rb#L55

@brixen brixen closed this in 6eaadc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.