Skip to content

Commit c9b9028

Browse files
pcaspersjenkins
authored andcommitted
QPR-11984 fix
1 parent 7ec4353 commit c9b9028

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

QuantExt/qle/math/randomvariable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Filter& Filter::operator=(const Filter& r) {
6767
delete[] data_;
6868
data_ = new bool[r.n_];
6969
}
70-
std::memcpy(data_, r.data_, n_ * sizeof(bool));
70+
std::memcpy(data_, r.data_, r.n_ * sizeof(bool));
7171
} else {
7272
if (data_) {
7373
delete[] data_;
@@ -285,7 +285,7 @@ RandomVariable& RandomVariable::operator=(const RandomVariable& r) {
285285
delete[] data_;
286286
data_ = new double[r.n_];
287287
}
288-
std::memcpy(data_, r.data_, n_ * sizeof(double));
288+
std::memcpy(data_, r.data_, r.n_ * sizeof(double));
289289
} else {
290290
if (data_) {
291291
delete[] data_;
@@ -348,7 +348,7 @@ void RandomVariable::copyToMatrixCol(QuantLib::Matrix& m, const Size j) const {
348348
if (deterministic_)
349349
std::fill(m.column_begin(j), std::next(m.column_end(j), n_), constantData_);
350350
else if (n_ != 0) {
351-
std::copy(data_, data_ + sizeof(double) * n_, m.column_begin(j));
351+
std::copy(data_, data_ + n_, m.column_begin(j));
352352
}
353353
}
354354

0 commit comments

Comments
 (0)