Skip to content

Commit e5c7c73

Browse files
author
luke
committed
Throw an error if names attribute has multiple references.
git-svn-id: https://svn.r-project.org/R/trunk@89035 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 2e7cce6 commit e5c7c73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/memory.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5075,7 +5075,11 @@ void R_resizeVector(SEXP x, R_xlen_t newlen)
50755075
if (getAttrib(x, R_DimNamesSymbol) != R_NilValue)
50765076
error(_("can't resize a vector with a 'dimnames' attribute"));
50775077
SEXP names = getAttrib(x, R_NamesSymbol);
5078-
R_resizeVector(names, newlen);
5078+
if (names != R_NilValue) {
5079+
if (MAYBE_SHARED(names))
5080+
error(_("can't resize 'names' might be shared"));
5081+
R_resizeVector(names, newlen);
5082+
}
50795083
}
50805084
R_xlen_t len = XLENGTH(x);
50815085
if (newlen < len) // clear dropped elements to drop refcounts

0 commit comments

Comments
 (0)