diff options
Diffstat (limited to 'Eigen/src/SparseCore/CompressedStorage.h')
-rw-r--r-- | Eigen/src/SparseCore/CompressedStorage.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Eigen/src/SparseCore/CompressedStorage.h b/Eigen/src/SparseCore/CompressedStorage.h index 49fd46658..52c7da297 100644 --- a/Eigen/src/SparseCore/CompressedStorage.h +++ b/Eigen/src/SparseCore/CompressedStorage.h @@ -86,7 +86,12 @@ class CompressedStorage void resize(Index size, double reserveSizeFactor = 0) { if (m_allocatedSize<size) - reallocate(size + Index(reserveSizeFactor*double(size))); + { + Index realloc_size = (std::min<Index>)(NumTraits<StorageIndex>::highest(), size + Index(reserveSizeFactor*double(size))); + if(realloc_size<size) + internal::throw_std_bad_alloc(); + reallocate(realloc_size); + } m_size = size; } |