Skip to content

Commit

Permalink
Drop some error messages to address security concerns with Rcpp::stop
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmohr committed Dec 13, 2023
1 parent afef125 commit 5854959
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: bvartools
Title: Bayesian Inference of Vector Autoregressive and Error Correction Models
Version: 0.2.3.9000
Version: 0.2.4
Date: 2023-08-23
Authors@R: person(c("Franz", "X."), "Mohr", email = "[email protected]", role = c("aut","cre"), comment = c(ORCiD = "0009-0003-8890-7781"))
Description: Assists in the set-up of algorithms for Bayesian inference of vector autoregressive (VAR) and error correction (VEC) models. Functions for posterior simulation, forecasting, impulse response analysis and forecast error variance decomposition are largely based on the introductory texts of Chan, Koop, Poirier and Tobias (2019, ISBN: 9781108437493), Koop and Korobilis (2010) <doi:10.1561/0800000013> and Luetkepohl (2006, ISBN: 9783540262398).
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# bvartools 0.2.4

* Dropped some error messages to fix a security concern with `Rcpp::stop`.
* `stochvol_ocsn2007` can handle multi-column input.
* `stochvol_ksc1998` can handle multi-column input.
* Added `post_gamma_state_variance` for posterior simulation of constant error variances of the state equation.
Expand Down
6 changes: 3 additions & 3 deletions src/stochvol_ksc1998.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
// [[Rcpp::export]]
arma::mat stochvol_ksc1998(arma::mat y, arma::mat h, arma::vec sigma, arma::vec h_init, arma::vec constant) {

if (y.has_nan()) {
Rcpp::stop("Argument 'y' contains NAs.");
}
// if (y.has_nan()) {
// Rcpp::stop("Argument 'y' contains NAs.");
// }

// Components of the mixture model
arma::rowvec p_i(7), mu(7), sigma2(7);
Expand Down
12 changes: 6 additions & 6 deletions src/stochvol_ocsn2007.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
// [[Rcpp::export]]
arma::mat stochvol_ocsn2007(arma::vec y, arma::vec h, double sigma, double h_init, double constant) {

if (y.has_nan()) {
Rcpp::stop("Argument 'y' contains NAs.");
}
// if (y.has_nan()) {
// Rcpp::stop("Argument 'y' contains NAs.");
// }

// Prepare series
y = log(arma::pow(y, 2) + constant);
arma::uword tt = y.n_elem;
if (y.n_elem != h.n_elem) {
Rcpp::stop("Arguments 'y' and 'h' do not have the same length.");
}
// if (y.n_elem != h.n_elem) {
// Rcpp::stop("Arguments 'y' and 'h' do not have the same length.");
// }

// Components of the mixture model
arma::rowvec p_i(10), mu(10), sigma2(10);
Expand Down

0 comments on commit 5854959

Please sign in to comment.