[PATCH] D93777: ADT: Fix pointer comparison UB in SmallVector

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 13:26:13 PST 2020


dexonsmith added inline comments.


================
Comment at: llvm/include/llvm/ADT/SmallVector.h:636
 
-    assert(I >= this->begin() && "Insertion iterator is out of bounds.");
-    assert(I <= this->end() && "Inserting past the end of the vector.");
+    assert(this->isReferenceToStorage(I) && "Insertion iterator is out of bounds.");
 
----------------
Note that this assertion (and a couple of others) would start firing on `I == this->end()`, but in each case that has been handled by an early return.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93777/new/

https://reviews.llvm.org/D93777



More information about the llvm-commits mailing list