Displaying 2 results from an estimated 2 matches for "r_chk_memcpy".
2025 Apr 23
1
R should add an API routine for safe use of memcpy(), memset() for use with 0-length SEXP
...as
>
> On Wed, Apr 23, 2025 at 1:38?PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote:
>> On 4/23/25 19:03, Michael Chirico wrote:
>>> h/t Tim Taylor for pointing out my blindspot :)
>>>
>>> We have Memcpy() in API already [1], which wraps a 0-aware R_chk_memcpy() [2].
>>>
>>> We don't quite have Memset() in API, though; instead we have Memzero()
>>> [3] for R_chk_memset(s, 0, n) which is 0-aware memset() [4].
>> I don't think that using wrappers for this is the right approach. Even
>> loading an invalid point...
2025 Apr 23
1
R should add an API routine for safe use of memcpy(), memset() for use with 0-length SEXP
>From R 4.5.0 [1], all builds of R discourage use of INTEGER() [and
friends REAL(), ... and *_RO() equivalents] 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