You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dogroups: don't access columns beyond end of table (#7485)
* dogroups: don't access columns beyond end of table
Previously, dogroups() could try to read elements after the (resized)
end of over-allocated data.table list, expecting them to be NULL. This
didn't crash in practice, but is now explicitly checked for (and
disallowed).
* add NEWS
---------
Co-authored-by: Benjamin Schwendinger <benjaminschwe@gmail.com>
Copy file name to clipboardExpand all lines: NEWS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,6 +352,8 @@ See [#2611](https://github.com/Rdatatable/data.table/issues/2611) for details. T
352
352
353
353
26.Groupingbyafactorwithmanygroupsisnowfastagain, fixingatimingregressionintroducedin [#6890](https://github.com/Rdatatable/data.table/pull/6890) where UTF-8 coercion and level remapping were performed unnecessarily, [#7404](https://github.com/Rdatatable/data.table/issues/7404). Thanks @ben-schwen for the report and fix.
354
354
355
+
27.`dogroups()`nolongerreadsbeyondtheresizedendofover-allocateddata.tablelistcolumns, [#7486](https://github.com/Rdatatable/data.table/issues/7486). While this didn't crash in practice, it is now explicitly checked for in recent R versions (r89198+). Thanks @TimTaylor and @aitap for the report and @aitap for the fix.
error(_("Supplied %d items to be assigned to group %d of size %d in column '%s'. The RHS length must either be 1 (single values are ok) or match the LHS length exactly. If you wish to 'recycle' the RHS please use rep() explicitly to make this intent clear to readers of your code."),vlen,i+1,grpn,CHAR(colname));
313
313
// e.g. in #91 `:=` did not issue recycling warning during grouping. Now it is error not warning.
314
314
}
315
315
}
316
316
intn=LENGTH(VECTOR_ELT(dt, 0));
317
317
for (intj=0; j<length(lhs); ++j) {
318
318
intcolj=INTEGER(lhs)[j]-1;
319
-
target=VECTOR_ELT(dt, colj);
320
319
RHS=VECTOR_ELT(jval,j%LENGTH(jval));
321
-
if (isNull(target)) {
320
+
if (colj >= LENGTH(dt)) {
322
321
// first time adding to new column
323
322
if (R_maxLength(dt) <colj+1) internal_error(__func__, "Trying to add new column by reference but tl is full; setalloccol should have run first at R level before getting to this point"); // # nocov
0 commit comments