diff options
author | Mike Dalessio <mike.dalessio@gmail.com> | 2023-11-12 16:29:58 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-14 14:11:55 +0000 |
commit | d6d1a1839abb64b40e5490509b498757a68c77f1 (patch) | |
tree | f53df7ac6542943713af349623245cf3e2f4ee70 /test/prism/snapshots | |
parent | 5844957f22835fdedfec8bfc9e8900f506b9efdf (diff) | |
download | ruby-d6d1a1839abb64b40e5490509b498757a68c77f1.tar.gz |
[ruby/prism] fix: nested heredoc dedentation use-after-free
Because the lex mode may be freed when popped, we need to store off
this value for dedentation.
https://github.com/ruby/prism/commit/64007322f5
Co-authored-by: Kevin Newton <kddnewton@gmail.com>
Diffstat (limited to 'test/prism/snapshots')
-rw-r--r-- | test/prism/snapshots/heredocs_nested.txt | 114 |
1 files changed, 82 insertions, 32 deletions
diff --git a/test/prism/snapshots/heredocs_nested.txt b/test/prism/snapshots/heredocs_nested.txt index f03aabc63a..e49e7df97a 100644 --- a/test/prism/snapshots/heredocs_nested.txt +++ b/test/prism/snapshots/heredocs_nested.txt @@ -1,39 +1,89 @@ -@ ProgramNode (location: (1,0)-(1,7)) +@ ProgramNode (location: (1,0)-(12,4)) ├── locals: [] └── statements: - @ StatementsNode (location: (1,0)-(1,7)) - └── body: (length: 1) - └── @ InterpolatedStringNode (location: (1,0)-(1,7)) - ├── opening_loc: (1,0)-(1,7) = "<<~RUBY" - ├── parts: (length: 4) - │ ├── @ StringNode (location: (2,0)-(3,0)) - │ │ ├── flags: ∅ - │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (2,0)-(3,0) = "pre\n" - │ │ ├── closing_loc: ∅ - │ │ └── unescaped: "pre\n" - │ ├── @ EmbeddedStatementsNode (location: (3,0)-(7,1)) - │ │ ├── opening_loc: (3,0)-(3,2) = "\#{" + @ StatementsNode (location: (1,0)-(12,4)) + └── body: (length: 2) + ├── @ InterpolatedStringNode (location: (1,0)-(1,7)) + │ ├── opening_loc: (1,0)-(1,7) = "<<~RUBY" + │ ├── parts: (length: 4) + │ │ ├── @ StringNode (location: (2,0)-(3,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (2,0)-(3,0) = "pre\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "pre\n" + │ │ ├── @ EmbeddedStatementsNode (location: (3,0)-(7,1)) + │ │ │ ├── opening_loc: (3,0)-(3,2) = "\#{" + │ │ │ ├── statements: + │ │ │ │ @ StatementsNode (location: (4,0)-(4,6)) + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ StringNode (location: (4,0)-(4,6)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (4,0)-(4,6) = "<<RUBY" + │ │ │ │ ├── content_loc: (5,0)-(6,0) = " hello\n" + │ │ │ │ ├── closing_loc: (6,0)-(7,0) = "RUBY\n" + │ │ │ │ └── unescaped: " hello\n" + │ │ │ └── closing_loc: (7,0)-(7,1) = "}" + │ │ ├── @ StringNode (location: (7,1)-(8,0)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (7,1)-(8,0) = "\n" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "\n" + │ │ └── @ StringNode (location: (8,0)-(9,0)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: ∅ + │ │ ├── content_loc: (8,0)-(9,0) = "post\n" + │ │ ├── closing_loc: ∅ + │ │ └── unescaped: "post\n" + │ └── closing_loc: (9,0)-(10,0) = "RUBY\n" + └── @ InterpolatedStringNode (location: (12,0)-(12,4)) + ├── opening_loc: (12,0)-(12,4) = "<<-A" + ├── parts: (length: 2) + │ ├── @ EmbeddedStatementsNode (location: (13,0)-(21,1)) + │ │ ├── opening_loc: (13,0)-(13,2) = "\#{" │ │ ├── statements: - │ │ │ @ StatementsNode (location: (4,0)-(4,6)) + │ │ │ @ StatementsNode (location: (14,0)-(14,4)) │ │ │ └── body: (length: 1) - │ │ │ └── @ StringNode (location: (4,0)-(4,6)) - │ │ │ ├── flags: ∅ - │ │ │ ├── opening_loc: (4,0)-(4,6) = "<<RUBY" - │ │ │ ├── content_loc: (5,0)-(6,0) = " hello\n" - │ │ │ ├── closing_loc: (6,0)-(7,0) = "RUBY\n" - │ │ │ └── unescaped: " hello\n" - │ │ └── closing_loc: (7,0)-(7,1) = "}" - │ ├── @ StringNode (location: (7,1)-(8,0)) - │ │ ├── flags: ∅ - │ │ ├── opening_loc: ∅ - │ │ ├── content_loc: (7,1)-(8,0) = "\n" - │ │ ├── closing_loc: ∅ - │ │ └── unescaped: "\n" - │ └── @ StringNode (location: (8,0)-(9,0)) + │ │ │ └── @ InterpolatedStringNode (location: (14,0)-(14,4)) + │ │ │ ├── opening_loc: (14,0)-(14,4) = "<<-B" + │ │ │ ├── parts: (length: 2) + │ │ │ │ ├── @ EmbeddedStatementsNode (location: (15,0)-(19,1)) + │ │ │ │ │ ├── opening_loc: (15,0)-(15,2) = "\#{" + │ │ │ │ │ ├── statements: + │ │ │ │ │ │ @ StatementsNode (location: (16,0)-(16,4)) + │ │ │ │ │ │ └── body: (length: 1) + │ │ │ │ │ │ └── @ InterpolatedStringNode (location: (16,0)-(16,4)) + │ │ │ │ │ │ ├── opening_loc: (16,0)-(16,4) = "<<-C" + │ │ │ │ │ │ ├── parts: (length: 2) + │ │ │ │ │ │ │ ├── @ EmbeddedStatementsNode (location: (17,0)-(17,4)) + │ │ │ │ │ │ │ │ ├── opening_loc: (17,0)-(17,2) = "\#{" + │ │ │ │ │ │ │ │ ├── statements: + │ │ │ │ │ │ │ │ │ @ StatementsNode (location: (17,2)-(17,3)) + │ │ │ │ │ │ │ │ │ └── body: (length: 1) + │ │ │ │ │ │ │ │ │ └── @ IntegerNode (location: (17,2)-(17,3)) + │ │ │ │ │ │ │ │ │ └── flags: decimal + │ │ │ │ │ │ │ │ └── closing_loc: (17,3)-(17,4) = "}" + │ │ │ │ │ │ │ └── @ StringNode (location: (17,4)-(18,0)) + │ │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ │ ├── content_loc: (17,4)-(18,0) = "\n" + │ │ │ │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ │ │ │ └── unescaped: "\n" + │ │ │ │ │ │ └── closing_loc: (18,0)-(19,0) = "C\n" + │ │ │ │ │ └── closing_loc: (19,0)-(19,1) = "}" + │ │ │ │ └── @ StringNode (location: (19,1)-(20,0)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── content_loc: (19,1)-(20,0) = "\n" + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ └── unescaped: "\n" + │ │ │ └── closing_loc: (20,0)-(21,0) = "B\n" + │ │ └── closing_loc: (21,0)-(21,1) = "}" + │ └── @ StringNode (location: (21,1)-(22,0)) │ ├── flags: ∅ │ ├── opening_loc: ∅ - │ ├── content_loc: (8,0)-(9,0) = "post\n" + │ ├── content_loc: (21,1)-(22,0) = "\n" │ ├── closing_loc: ∅ - │ └── unescaped: "post\n" - └── closing_loc: (9,0)-(10,0) = "RUBY\n" + │ └── unescaped: "\n" + └── closing_loc: (22,0)-(23,0) = "A\n" |