Commit 55160e6
authored
[ConstEval] Fix crash when comparing strings past the end (#137078)
When `ArePotentiallyOverlappingStringLiterals`, added in #109208, compares string literals it drops the front of the string with the greatest offset from its base pointer. The number of characters dropped is equal to the difference between the two strings' offsets from their base pointers. This would trigger an assert when the resulting offset is past the end of the object. Not only are one-past-the-end pointers legal constructs, the compiler should not crash even when faced with illegal constructs. rdar://1498659101 parent 2397180 commit 55160e6
File tree
3 files changed
+18
-2
lines changed- clang
- lib/AST
- test
- AST/ByteCode
- SemaCXX
3 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2232 | 2232 | | |
2233 | 2233 | | |
2234 | 2234 | | |
2235 | | - | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
2236 | 2238 | | |
2237 | | - | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
2238 | 2242 | | |
| 2243 | + | |
2239 | 2244 | | |
2240 | 2245 | | |
2241 | 2246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2203 | 2203 | | |
2204 | 2204 | | |
2205 | 2205 | | |
| 2206 | + | |
| 2207 | + | |
2206 | 2208 | | |
2207 | 2209 | | |
2208 | 2210 | | |
| |||
0 commit comments