Skip to content

Commit e29ba09

Browse files
Fix Review comments
Relates-To: HERESUP-57013 Signed-off-by: Mykhailo Diachenko <ext-mykhailo.z.diachenko@here.com>
1 parent a279c11 commit e29ba09

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

olp-cpp-sdk-authentication/src/AuthenticationClientUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2024 HERE Europe B.V.
2+
* Copyright (C) 2020-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

olp-cpp-sdk-authentication/src/Rfc1123Helper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2024 HERE Europe B.V.
2+
* Copyright (C) 2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,8 +62,9 @@ static_assert(std::numeric_limits<HourType>::max() >= 23,
6262
"HourType must be able to store values up to 23");
6363
static_assert(std::numeric_limits<MinuteType>::max() >= 59,
6464
"MinuteType must be able to store values up to 59");
65-
static_assert(std::numeric_limits<SecondType>::max() >= 59,
66-
"SecondType must be able to store values up to 59");
65+
static_assert(std::numeric_limits<SecondType>::max() >= 60,
66+
"SecondType must be able to store values up to 60, accounting "
67+
"for leap seconds");
6768

6869
std::string TrimDateHeaderValue(const std::string& value) {
6970
const auto begin = value.find_first_not_of(" \t\r\n");
@@ -164,7 +165,7 @@ bool ParseClockToken(const std::string& token, HourType* hour,
164165
return false;
165166
}
166167

167-
if (parsed_hour > 23 || parsed_minute > 59 || parsed_second > 59) {
168+
if (parsed_hour > 23 || parsed_minute > 59 || parsed_second > 60) {
168169
return false;
169170
}
170171

olp-cpp-sdk-authentication/src/Rfc1123Helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2026 HERE Europe B.V.
2+
* Copyright (C) 2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

olp-cpp-sdk-authentication/tests/Rfc1123HelperTest.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2024 HERE Europe B.V.
2+
* Copyright (C) 2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,8 +62,17 @@ INSTANTIATE_TEST_SUITE_P(
6262
static_cast<std::time_t>(1582977600)},
6363
ParseCase{"EndOfYear", "Thu, 31 Dec 2020 23:59:59 GMT",
6464
static_cast<std::time_t>(1609459199)},
65+
ParseCase{"March", "Sun, 8 Mar 2020 23:59:59 GMT",
66+
static_cast<std::time_t>(1583711999)},
67+
ParseCase{"Birthday", "Wed, 8 Apr 2020 23:59:59 GMT",
68+
static_cast<std::time_t>(1586390399)},
69+
ParseCase{"July", "Wed, 8 Jul 2020 23:59:59 GMT",
70+
static_cast<std::time_t>(1594252799)},
71+
ParseCase{"August", "Sat, 8 Aug 2020 23:59:59 GMT",
72+
static_cast<std::time_t>(1596931199)},
73+
// --- Before Epoch ---
6574
ParseCase{"MinValidYear", "Mon, 01 Jan 1400 00:00:00 GMT",
66-
kParseFailed}, // before epoch
75+
kParseFailed},
6776
// --- Empty / garbled input ---
6877
ParseCase{"EmptyString", "", kParseFailed},
6978
ParseCase{"WhitespaceOnly", " \t\r\n ", kParseFailed},
@@ -88,7 +97,7 @@ INSTANTIATE_TEST_SUITE_P(
8897
kParseFailed},
8998
ParseCase{"MinuteTooLarge", "Thu, 01 Jan 1970 12:60:00 GMT",
9099
kParseFailed},
91-
ParseCase{"SecondTooLarge", "Thu, 01 Jan 1970 12:00:60 GMT",
100+
ParseCase{"SecondTooLarge", "Thu, 01 Jan 1970 12:00:61 GMT",
92101
kParseFailed},
93102
ParseCase{"MalformedClock", "Thu, 01 Jan 1970 1:2:3 GMT", kParseFailed},
94103
// --- Invalid year ---
@@ -109,7 +118,14 @@ INSTANTIATE_TEST_SUITE_P(
109118
ParseCase{"WeekdayTooShort", "Th, 01 Jan 1970 00:00:00 GMT",
110119
kParseFailed},
111120
ParseCase{"WeekdayTooLong", "Thurs, 01 Jan 1970 00:00:00 GMT",
112-
kParseFailed}),
121+
kParseFailed},
122+
// --- Specific edge cases ---
123+
ParseCase{"DayAsLetters", "Thu, AA Dec 2020 23:59:59 GMT",
124+
static_cast<std::time_t>(kParseFailed)},
125+
ParseCase{"NonNumericClock", "Thu, 12 Dec 2020 11:AA:10 GMT",
126+
static_cast<std::time_t>(kParseFailed)}
127+
128+
),
113129
[](const ::testing::TestParamInfo<ParseCase>& info) {
114130
return info.param.name;
115131
});

0 commit comments

Comments
 (0)