Skip to content

Bugfix/issue375 string vector #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-09-21 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/String.h: Before assigning ensure we received
exactly one string argument

2015-09-10 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION: Release 0.12.1
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Rcpp
Title: Seamless R and C++ Integration
Version: 0.12.1
Date: 2015-09-10
Version: 0.12.1.1
Date: 2015-09-21
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
Qiang Kou, Douglas Bates and John Chambers
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Expand Down
10 changes: 10 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
\title{News for Package 'Rcpp'}
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}

\section{Changes in Rcpp version 0.12.2 (expected 2015-11-01 or later)}{
\itemize{
\item Changes in Rcpp API:
\itemize{
\item Before creating a single String object from a \code{SEXP}, ensure
that it is from a vector of length one (issue #375)
}
}
}

\section{Changes in Rcpp version 0.12.1 (2015-09-10)}{
\itemize{
\item Changes in Rcpp API:
Expand Down
6 changes: 5 additions & 1 deletion inst/include/Rcpp/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ namespace Rcpp {

/** construct a string from a single CHARSXP SEXP */
String(SEXP charsxp) : data(charsxp), valid(true), buffer_ready(false), enc(Rf_getCharCE(charsxp)) {
Rcpp_PreserveObject( data );
if (::Rf_isString(data) && ::Rf_length(data) != 1)
throw ::Rcpp::not_compatible("expecting a single value");
Rcpp_PreserveObject(data);
RCPP_STRING_DEBUG( "String(SEXP)" ) ;
}

String(SEXP charsxp, const std::string& enc) : data(charsxp), valid(true), buffer_ready(false) {
if (::Rf_isString(data) && ::Rf_length(data) != 1)
throw ::Rcpp::not_compatible("expecting a single value");
Rcpp_PreserveObject( data );
set_encoding(enc);
RCPP_STRING_DEBUG( "String(SEXP)" ) ;
Expand Down