mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-23 23:03:15 +08:00
Protect use of alloca.
This commit is contained in:
parent
b86641a4c2
commit
a39ade4ccf
@ -301,9 +301,13 @@ struct trmv_selector<Mode, RowMajor> {
|
|||||||
} else {
|
} else {
|
||||||
// Allocate either with alloca or malloc.
|
// Allocate either with alloca or malloc.
|
||||||
Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size());
|
Eigen::internal::check_size_for_overflow<RhsScalar>(actualRhs.size());
|
||||||
|
#ifdef EIGEN_ALLOCA
|
||||||
buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT)
|
buffer = static_cast<RhsScalar*>((sizeof(RhsScalar) * actualRhs.size() <= EIGEN_STACK_ALLOCATION_LIMIT)
|
||||||
? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size())
|
? EIGEN_ALIGNED_ALLOCA(sizeof(RhsScalar) * actualRhs.size())
|
||||||
: Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size()));
|
: Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size()));
|
||||||
|
#else
|
||||||
|
buffer = static_cast<RhsScalar*>(Eigen::internal::aligned_malloc(sizeof(RhsScalar) * actualRhs.size()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
Index size = actualRhs.size();
|
Index size = actualRhs.size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user