Skip to content

Commit a616631

Browse files
committed
[clang-refactor] Fix an issue where an out of bounds NodeTree access was used when canonicalizing an expression
(cherry picked from commit 0bf62cd)
1 parent b63524b commit a616631

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Tooling/Refactor/ASTSlice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ canonicalizeSelectedExpr(const Stmt *S, unsigned Index,
261261

262262
// Look through the implicit casts in the parents.
263263
unsigned ParentIndex = Index + 1;
264-
for (; ParentIndex <= NodeTree.size() && isa<ImplicitCastExpr>(Parent);
264+
for (; (ParentIndex + 1) < NodeTree.size() && isa<ImplicitCastExpr>(Parent);
265265
++ParentIndex) {
266266
const Stmt *NewParent = NodeTree[ParentIndex + 1].getStmtOrNull();
267267
if (!NewParent)

0 commit comments

Comments
 (0)