Skip to content

Commit bc529e0

Browse files
committed
use warning instead of stop
1 parent 69cb4dd commit bc529e0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

inst/include/Rcpp/vector/traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace traits{
5656
void check_index(R_xlen_t i) const {
5757
#ifndef RCPP_NO_BOUNDS_CHECK
5858
if (i >= size) {
59-
stop("subscript out of bounds (index %s >= vector size %s)", i, size);
59+
warning("subscript out of bounds (index %s >= vector size %s)", i, size);
6060
}
6161
#endif
6262
}
@@ -94,7 +94,7 @@ namespace traits{
9494
void check_index(R_xlen_t i) const {
9595
#ifndef RCPP_NO_BOUNDS_CHECK
9696
if (i >= p->size()) {
97-
stop("subscript out of bounds (index %s >= vector size %s)", i, p->size());
97+
warning("subscript out of bounds (index %s >= vector size %s)", i, p->size());
9898
}
9999
#endif
100100
}

inst/tinytest/test_vector.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,9 @@ expect_true( !CharacterVector_test_equality("foo", "bar") )
696696
expect_true( !CharacterVector_test_equality_crosspolicy("foo", "bar") )
697697

698698
# https://github.com/RcppCore/Rcpp/issues/1308
699-
expect_error(NumericVector_test_out_of_bounds_read(numeric(0), 0))
700-
expect_error(NumericVector_test_out_of_bounds_read(numeric(1), 1))
701-
expect_error(CharacterVector_test_out_of_bounds_read(character(0), 0))
702-
expect_error(CharacterVector_test_out_of_bounds_read(character(1), 1))
699+
# tests disabled since these could trigger UBSAN warnings / crashes
700+
#expect_warning(NumericVector_test_out_of_bounds_read(numeric(0), 0))
701+
#expect_warning(NumericVector_test_out_of_bounds_read(numeric(1), 1))
702+
#expect_warning(CharacterVector_test_out_of_bounds_read(character(0), 0))
703+
#expect_warning(CharacterVector_test_out_of_bounds_read(character(1), 1))
703704

0 commit comments

Comments
 (0)