Skip to content

Commit 900c02f

Browse files
committed
out of bounds access
1 parent 97c46ad commit 900c02f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ql/time/ecb.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ namespace QuantLib {
152152
ecbCode << " is not a valid ECB code");
153153

154154
char upperMonthCode[3];
155-
to_upper_copy(upperMonthCode, ecbCode);
156-
const boost::string_view monthString(upperMonthCode, 3);
157-
const auto it = std::find(MONTHS.begin(), MONTHS.end(), monthString);
155+
to_upper_copy(upperMonthCode, boost::string_view(ecbCode.data(), 3));
156+
const auto it = std::find(MONTHS.begin(), MONTHS.end(), boost::string_view(upperMonthCode, 3));
158157
QL_ASSERT(it != MONTHS.end() ,"not an ECB month (and it should have been). code: " + ecbCode);
159158

160159
// QuantLib::Month is 1-based!

0 commit comments

Comments
 (0)