aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-06-20 13:56:48 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-06-20 13:56:48 +0200
commit84aaef93bac733f1e9e670b38be9465e4816cfbd (patch)
treec34bb18a582f3192d86d7e23286df496c0312e64 /Eigen
parent6b33b29f00283ecb60389df0cca8729fe02f1b6c (diff)
parent368ea234066a14d9427fd59ab064e2c6d96ba723 (diff)
Merged in vanhoucke/eigen_vanhoucke (pull request PR-118)
Fix two small undefined behaviors caught by static analysis.
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/SparseCore/CompressedStorage.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/Eigen/src/SparseCore/CompressedStorage.h b/Eigen/src/SparseCore/CompressedStorage.h
index 5af270bc5..d667944ce 100644
--- a/Eigen/src/SparseCore/CompressedStorage.h
+++ b/Eigen/src/SparseCore/CompressedStorage.h
@@ -229,8 +229,10 @@ class CompressedStorage
internal::scoped_array<Scalar> newValues(size);
internal::scoped_array<StorageIndex> newIndices(size);
Index copySize = (std::min)(size, m_size);
- internal::smart_copy(m_values, m_values+copySize, newValues.ptr());
- internal::smart_copy(m_indices, m_indices+copySize, newIndices.ptr());
+ if (copySize>0) {
+ internal::smart_copy(m_values, m_values+copySize, newValues.ptr());
+ internal::smart_copy(m_indices, m_indices+copySize, newIndices.ptr());
+ }
std::swap(m_values,newValues.ptr());
std::swap(m_indices,newIndices.ptr());
m_allocatedSize = size;