From 2b464daed57a1d124d735cb6717ecc752efbc0c7 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Fri, 7 Feb 2025 10:00:41 -0800 Subject: [PATCH 1/2] Cannot UNPROTECT recycleAscArg SEXP which livs on as ascArg --- src/forder.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/forder.c b/src/forder.c index b32215d1c6..a82854e228 100644 --- a/src/forder.c +++ b/src/forder.c @@ -488,11 +488,10 @@ SEXP forder(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP sortGroupsA if (LENGTH(ascArg) != LENGTH(by)) { if (LENGTH(ascArg)!=1) STOP(_("'order' length (%d) is different to by='s length (%d)"), LENGTH(ascArg), LENGTH(by)); - SEXP recycleAscArg = PROTECT(allocVector(INTSXP, LENGTH(by))); + SEXP recycleAscArg = PROTECT(allocVector(INTSXP, LENGTH(by))); n_protect++; for (int j=0; j Date: Fri, 7 Feb 2025 10:03:29 -0800 Subject: [PATCH 2/2] NEWS --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index f0ddda29e5..046c6efc48 100644 --- a/NEWS.md +++ b/NEWS.md @@ -133,6 +133,8 @@ rowwiseDT( 19. An integer overflow in `fread()` with lines longer than `2^(31/2)` bytes is prevented, [#6729](https://github.com/Rdatatable/data.table/issues/6729). The typical impact was no worse than a wrong initial allocation size, corrected later. Thanks to @TaikiSan21 for the report and @aitap for the fix. +20. Fixed a memory issue causing segfaults in `forder`, [#6797](https://github.com/Rdatatable/data.table/issues/6797). Thanks @dkutner for the report and @MichaelChirico for the fix. + ## NOTES 1. There is a new vignette on joins! See `vignette("datatable-joins")`. Thanks to Angel Feliz for authoring it! Feedback welcome. This vignette has been highly requested since 2017: [#2181](https://github.com/Rdatatable/data.table/issues/2181).