search for: integer_ro

Displaying 2 results from an estimated 2 matches for "integer_ro".

Did you mean: integer_c
2025 Apr 23
1
R should add an API routine for safe use of memcpy(), memset() for use with 0-length SEXP
...lents] on length-0 SEXP [2]. Before R 4.5.0, this was the behavior under --enable-strict-barrier. That means the following can segfault under strict builds (e.g. -fsanitize=alignment and -O0): SEXP x = PROTECT(Rf_allocVector(INTSXP, 0)); SEXP y = PROTECT(Rf_allocVector(INTSXP, 0)); const int *x = INTEGER_RO(x); // invalid! int *y = INTEGER(y); memcpy(y, x, 0); // alluring, but undefined behavior! There are a number of CRAN packages that fall victim to this, see e.g. this PR and others linked to it [3]. I'm sure there are dozens if not hundreds of other equivalent bugs waiting to be discovered tha...
2025 Apr 23
1
R should add an API routine for safe use of memcpy(), memset() for use with 0-length SEXP
...t;>>> That means the following can segfault under strict builds (e.g. >>>> -fsanitize=alignment and -O0): >>>> >>>> SEXP x = PROTECT(Rf_allocVector(INTSXP, 0)); >>>> SEXP y = PROTECT(Rf_allocVector(INTSXP, 0)); >>>> const int *x = INTEGER_RO(x); // invalid! >>>> int *y = INTEGER(y); >>>> memcpy(y, x, 0); // alluring, but undefined behavior! >>>> >>>> There are a number of CRAN packages that fall victim to this, see e.g. >>>> this PR and others linked to it [3]. I'm sure th...