Changes in directory llvm/include/llvm/ADT:
SmallVector.h updated: 1.28 -> 1.29 --- Log message: Fix some sporadic segfaults that are triggered when SmallVector's heap storage lands near the end of the available address space. In the expression Begin+N > Capacity, the Begin+N was overflowing. Fix this by replacing it by with an expression that doesn't involve computation of an address beyond the end of allocated memory. --- Diffs of the changes: (+3 -3) SmallVector.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/ADT/SmallVector.h diff -u llvm/include/llvm/ADT/SmallVector.h:1.28 llvm/include/llvm/ADT/SmallVector.h:1.29 --- llvm/include/llvm/ADT/SmallVector.h:1.28 Wed Apr 18 21:04:09 2007 +++ llvm/include/llvm/ADT/SmallVector.h Thu May 17 13:29:01 2007 @@ -147,7 +147,7 @@ destroy_range(Begin+N, End); End = Begin+N; } else if (N > size()) { - if (Begin+N > Capacity) + if (Capacity-Begin < N) grow(N); construct_range(End, Begin+N, T()); End = Begin+N; @@ -159,7 +159,7 @@ destroy_range(Begin+N, End); End = Begin+N; } else if (N > size()) { - if (Begin+N > Capacity) + if (Capacity-Begin < N) grow(N); construct_range(End, Begin+N, NV); End = Begin+N; @@ -189,7 +189,7 @@ void assign(unsigned NumElts, const T &Elt) { clear(); - if (Begin+NumElts > Capacity) + if (Capacity-Begin < NumElts) grow(NumElts); End = Begin+NumElts; construct_range(Begin, End, Elt); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits