diff options
author | Mike Dalessio <mike.dalessio@gmail.com> | 2023-08-30 13:30:29 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-30 20:46:09 +0000 |
commit | bbaae3681ca9b4d00f2bb2330da1c7e3ff06cd17 (patch) | |
tree | b8eee6f4406a2f3dabb229b015815ef87efe66aa /test | |
parent | 6beaf010a447ce9fb35c85f9fb2f41685e2114ba (diff) | |
download | ruby-bbaae3681ca9b4d00f2bb2330da1c7e3ff06cd17.tar.gz |
[ruby/yarp] fix: regular expression with start and end out of order
Also, a similar test and fix for interpolated regular expressions.
This snippet:
<<-A.g//,
A
/{/, ''\
previously created a regular expression node with inverted start and
end:
RegularExpressionNode(14...13)((14...15), (15...21), (12...13), ", ''", 0),
which failed an assertion during serialization.
After this change:
RegularExpressionNode(12...15)((14...15), (15...21), (12...13), ", ''", 0),
Found by the fuzzer.
https://github.com/ruby/yarp/commit/5fef572f95
Diffstat (limited to 'test')
-rw-r--r-- | test/yarp/fuzzer_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb index 4d7a0af8e7..568c2eaf08 100644 --- a/test/yarp/fuzzer_test.rb +++ b/test/yarp/fuzzer_test.rb @@ -33,5 +33,16 @@ module YARP A /, ""\\ EOF + snippet "regular expression with start and end out of order", <<~RUBY + <<-A.g//, + A + /{/, ''\\ + RUBY + snippet "interpolated regular expression with start and end out of order", <<~RUBY + <<-A.g/{/, + A + a + /{/, ''\\ + RUBY end end |