Skip to content

Commit f82ac81

Browse files
committed
earlier test for dimensions conformance
1 parent be96204 commit f82ac81

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inst/include/RcppEigenWrap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ namespace Rcpp{
8888
T::ColsAtCompileTime>,
8989
const T&>::type objCopy(obj);
9090
R_xlen_t m = obj.rows(), n = obj.cols(), size = m * n;
91+
if (m > INT_MAX || n > INT_MAX) {
92+
Rcpp::stop("array dimensions cannot exceed INT_MAX");
93+
}
9194
SEXP ans = PROTECT(::Rcpp::wrap(objCopy.data(), objCopy.data() + size));
9295
if ( T::ColsAtCompileTime != 1 ) {
93-
if (m > INT_MAX || n > INT_MAX) {
94-
Rcpp::stop("array dimensions cannot exceed INT_MAX");
95-
}
9696
SEXP dd = PROTECT(::Rf_allocVector(INTSXP, 2));
9797
int *d = INTEGER(dd);
9898
d[0] = m;

0 commit comments

Comments
 (0)