Regex character class crash #2003

Closed
wjessop opened this Issue Nov 10, 2012 · 3 comments

Comments

Projects
None yet
2 participants

wjessop commented Nov 10, 2012

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.

Owner

brixen commented Nov 10, 2012

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

Owner

brixen commented Nov 13, 2012

@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 commented Nov 13, 2012

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 closed this in 6eaadc1 Dec 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment