Commit 020f763
committed
Fix a stack overflow when using
`canRecoverTo` calls itself recursively if it finds a nested opening token, eg. when calling `canRecoverTo` on `{{{`. To avoid stack overflowing, limit the number of nested `canRecoverTo` calls we make. Since returning a recovery handle from this function only improves error recovery but is not necessary for correctness, bailing from recovery is safe.canRecoveryTo with too many open delimiters1 parent 0bf5b6c commit 020f763
File tree
2 files changed
+18
-7
lines changed- Sources/SwiftParser
- Tests/SwiftParserTest
2 files changed
+18
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
| |||
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
147 | | - | |
| 159 | + | |
148 | 160 | | |
149 | 161 | | |
150 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
| |||
0 commit comments