Skip to content

Commit 2e5dda5

Browse files
committed
Merge branch 'release/1.8.16.0' into 'master'
QPR-14084: misc. fixes for coverity scans See merge request app/app-51172/qs/ore-github!3
2 parents 9b65ab3 + 90c91cb commit 2e5dda5

51 files changed

Lines changed: 157 additions & 86 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_windows_pypy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
pip install setuptools
4242
- name: zlib
4343
run: |
44-
$Url = "https://www.zlib.net/zlib131.zip"
44+
$Url = "https://www.zlib.net/zlib132.zip"
4545
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\zlib.zip")
4646
Expand-Archive -Path "$env:TEMP\zlib.zip" -DestinationPath C:\local
47-
cd C:\local\zlib-1.3.1
47+
cd C:\local\zlib-1.3.2
4848
mkdir build
4949
cd build
5050
cmake ..
@@ -71,12 +71,12 @@ jobs:
7171
run: |
7272
SET ORE_DIR=%cd%
7373
SET ORE=%cd%
74-
SET ZLIB_ROOT=C:\local\zlib-1.3.1
75-
SET ZLIB_INCLUDE_DIR=C:\local\zlib-1.3.1
74+
SET ZLIB_ROOT=C:\local\zlib-1.3.2
75+
SET ZLIB_INCLUDE_DIR=C:\local\zlib-1.3.2
7676
SET Eigen3_DIR=C:\local\eigen-3.4.0
7777
mkdir build
7878
cd build
79-
cmake -DORE_BUILD_DOC=OFF -DORE_BUILD_EXAMPLES=OFF -DORE_BUILD_SWIG=false -DORE_BUILD_TESTS=OFF -DORE_BUILD_APP=OFF -DORE_PYTHON_INTEGRATION=OFF -DQL_BUILD_BENCHMARK=OFF -DQL_BUILD_EXAMPLES=OFF -DQL_BUILD_TEST_SUITE=OFF -DCMAKE_BUILD_TYPE=Release -DMSVC_LINK_DYNAMIC_RUNTIME=OFF -DORE_USE_ZLIB=ON -DQL_ENABLE_SESSIONS=ON -DZLIB_LIBRARY=C:\local\zlib-1.3.1\build\Release\zlibstatic.lib -DZLIB_INCLUDE_DIR=C:\local\zlib-1.3.1 -G "Visual Studio 17 2022" -A ${{ matrix.platform }} ..
79+
cmake -DORE_BUILD_DOC=OFF -DORE_BUILD_EXAMPLES=OFF -DORE_BUILD_SWIG=false -DORE_BUILD_TESTS=OFF -DORE_BUILD_APP=OFF -DORE_PYTHON_INTEGRATION=OFF -DQL_BUILD_BENCHMARK=OFF -DQL_BUILD_EXAMPLES=OFF -DQL_BUILD_TEST_SUITE=OFF -DCMAKE_BUILD_TYPE=Release -DMSVC_LINK_DYNAMIC_RUNTIME=OFF -DORE_USE_ZLIB=ON -DQL_ENABLE_SESSIONS=ON -DZLIB_LIBRARY=C:\local\zlib-1.3.2\build\Release\zs.lib -DZLIB_INCLUDE_DIR=C:\local\zlib-1.3.2 -G "Visual Studio 17 2022" -A ${{ matrix.platform }} ..
8080
cmake --build . --config Release --verbose
8181
- name: Wrap ORE-SWIG for Python Wheels
8282
run: |

.github/workflows/linux_build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v5
1515
with:
1616
submodules: recursive
17-
token: ${{ secrets.ORG_ACTIONS_ACCESS_1 }}
17+
#token: ${{ secrets.ORG_ACTIONS_ACCESS_1 }}
1818
- name: set up dependencies
1919
run: |
2020
sudo apt update

OREAnalytics/orea/aggregation/simmhelper.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ class SimmHelper {
9090
QuantExt::RandomVariable irDeltaIM_, irVegaIM_, irCurvatureIM_;
9191
QuantExt::RandomVariable fxDeltaIM_, fxVegaIM_, fxCurvatureIM_;
9292

93-
Real totalMargin_;
94-
Real deltaMargin_;
95-
Real vegaMargin_;
96-
Real curvatureMargin_;
97-
Real irDeltaMargin_;
98-
Real fxDeltaMargin_;
93+
Real totalMargin_ = Null<Real>();
94+
Real deltaMargin_ = Null<Real>();
95+
Real vegaMargin_ = Null<Real>();
96+
Real curvatureMargin_ = Null<Real>();
97+
Real irDeltaMargin_ = Null<Real>();
98+
Real fxDeltaMargin_ = Null<Real>();
9999
};
100100

101101
} // namespace analytics

OREAnalytics/orea/app/analytics/calibrationanalytic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ void CalibrationAnalyticImpl::runAnalytic(const QuantLib::ext::shared_ptr<ore::d
526526
for (auto const& ccyMatrix : hwHistoricalModelData_->v()) {
527527
std::string ccy = ccyMatrix.first;
528528
Matrix v = ccyMatrix.second;
529+
QL_REQUIRE(hwHistoricalModelData_->kappa().find(ccy) != hwHistoricalModelData_->kappa().end(),
530+
"Kappa matrix not found for currency " << ccy);
529531
Matrix kappa = hwHistoricalModelData_->kappa().find(ccy)->second;
530532

531533
CSVFileReport report((outputDir / (stem + "_" + ccy + extension)).string());

OREAnalytics/orea/app/oreapp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class OREApp {
124124

125125
//! Logging
126126
string logFile_;
127-
Size logMask_;
127+
Size logMask_ = 15;
128128
bool console_;
129129
string outputPath_;
130130
bool clearLog_ = true;

OREAnalytics/orea/app/reportwriter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,6 +3048,8 @@ void ReportWriter::writeModelPathReport(ore::data::Report& report, const ext::sh
30483048
if (date == today)
30493049
continue;
30503050
auto it = paths.data.find(date);
3051+
if (it == paths.data.end())
3052+
continue;
30513053
for (Size i = 0; i < paths.indexNames.size(); ++i) {
30523054
for (Size j = 0; j < paths.samples; ++j) {
30533055
report.next().add(id).add(paths.indexNames[i]).add(date).add(j).add(it->second[i][j]);

OREAnalytics/orea/engine/parsensitivitycubestream.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ SensitivityRecord ParSensitivityCubeStream::next() {
5656
tradeIdx_++;
5757
if (tradeIdx_ != cube_->zeroCubes()[zeroCubeIdx_]->tradeIdx().end()) {
5858
// update trade currency
59-
if (!tradeCurrency_.empty())
60-
currentTradeCurrency_ = tradeCurrency_.find(tradeIdx_->first)->second;
59+
if (!tradeCurrency_.empty()) {
60+
auto it = tradeCurrency_.find(tradeIdx_->first);
61+
QL_REQUIRE(it != tradeCurrency_.end(),
62+
"cannot find currency for trade " << tradeIdx_->first << "in tradeCurrency map");
63+
currentTradeCurrency_ = it->second;
64+
}
6165
// update par deltas
6266
DLOG("Retrieving par deltas for trade " << tradeIdx_->first);
6367
currentDeltas_ = cube_->parDeltas(zeroCubeIdx_, tradeIdx_->second);
@@ -107,8 +111,12 @@ void ParSensitivityCubeStream::init() {
107111
// If we have trade IDs in the underlying cube
108112
if (!cube_->zeroCubes()[zeroCubeIdx_]->tradeIdx().empty()) {
109113
tradeIdx_ = cube_->zeroCubes()[zeroCubeIdx_]->tradeIdx().begin();
110-
if (!tradeCurrency_.empty())
111-
currentTradeCurrency_ = tradeCurrency_.find(tradeIdx_->first)->second;
114+
if (!tradeCurrency_.empty()) {
115+
auto it = tradeCurrency_.find(tradeIdx_->first);
116+
QL_REQUIRE(it != tradeCurrency_.end(),
117+
"cannot find currency for trade " << tradeIdx_->first << "in tradeCurrency map");
118+
currentTradeCurrency_ = it->second;
119+
}
112120
DLOG("Retrieving par deltas for trade " << tradeIdx_->first);
113121
currentDeltas_ = cube_->parDeltas(zeroCubeIdx_, tradeIdx_->second);
114122
itCurrent_ = currentDeltas_.begin();

OREAnalytics/orea/engine/saccrtradedata.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ class SaccrTradeData : public QuantLib::ext::enable_shared_from_this<SaccrTradeD
205205
UnderlyingData underlyingData; // SA-CCR/ORE assetClass, qualifier/underlyingName, isIndex
206206
HedgingData hedgingData; // hedgingSet, hedgingSubset, isVol
207207
std::string currency; // currency of the notional and other amounts
208-
QuantLib::Real adjustedNotional, delta;
208+
QuantLib::Real adjustedNotional = QuantLib::Null<QuantLib::Real>();
209+
QuantLib::Real delta;
209210
QuantLib::Real maturity = QuantLib::Null<QuantLib::Real>();
210211
QuantLib::Real maturityFactor = QuantLib::Null<QuantLib::Real>();
211212
bool isOption, isVol;

OREAnalytics/orea/engine/sensitivityanalysis.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class SensitivityAnalysis : public ore::data::ProgressReporter {
185185

186186
bool useSingleThreadedEngine_;
187187
// additional members needed for multihreaded constructor
188-
Size nThreads_;
188+
Size nThreads_ = 1;
189189
QuantLib::ext::shared_ptr<ore::data::Loader> loader_;
190190
std::string context_;
191191
bool useAtParCouponsCurves_ = true;

OREAnalytics/orea/engine/sensitivitycubestream.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ void SensitivityCubeStream::updateForNewTrade() {
141141
if (tradeIdx_ != cubes_[currentCubeIdx_]->tradeIdx().end()) {
142142

143143
// add trade currency
144-
if (!tradeCurrency_.empty())
144+
if (!tradeCurrency_.empty()) {
145+
QL_REQUIRE(tradeCurrency_.find(tradeIdx_->first) != tradeCurrency_.end(),
146+
"cannot find currency for trade " << tradeIdx_->first << "in tradeCurrency map");
145147
currentTradeCurrency_ = tradeCurrency_.find(tradeIdx_->first)->second;
146-
148+
}
147149
// add delta keys
148150

149151
for (auto const& [idx, _] : cubes_[currentCubeIdx_]->npvCube()->getTradeNPVs(tradeIdx_->second)) {

0 commit comments

Comments
 (0)