Skip to content

Commit a84a9f8

Browse files
author
luke
committed
Disallow resizing of vector that might be shared.
git-svn-id: https://svn.r-project.org/R/trunk@89036 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e5c7c73 commit a84a9f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/memory.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5069,6 +5069,8 @@ void R_resizeVector(SEXP x, R_xlen_t newlen)
50695069
error(_("not a resizable vector"));
50705070
if (newlen > XTRUELENGTH(x))
50715071
error(_("'newlen' is too large"));
5072+
if (MAYBE_SHARED(x))
5073+
error(_("can't resize a vector that might be shared"));
50725074
if (ATTRIB(x) != R_NilValue) {
50735075
if (getAttrib(x, R_DimSymbol) != R_NilValue)
50745076
error(_("can't resize a vector with a 'dim' attribute"));
@@ -5077,7 +5079,7 @@ void R_resizeVector(SEXP x, R_xlen_t newlen)
50775079
SEXP names = getAttrib(x, R_NamesSymbol);
50785080
if (names != R_NilValue) {
50795081
if (MAYBE_SHARED(names))
5080-
error(_("can't resize 'names' might be shared"));
5082+
error(_("can't resize 'names' that might be shared"));
50815083
R_resizeVector(names, newlen);
50825084
}
50835085
}

0 commit comments

Comments
 (0)