From 8f7f487e4458046ffb09cb64105315e3ec8afcdc Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 9 Jan 2026 14:34:38 +0100 Subject: [PATCH 1/4] Limit max exclude classes to 7 --- include/extractor/class_data.hpp | 8 +++++--- include/extractor/profile_properties.hpp | 2 +- include/util/exclude_flag.hpp | 2 +- unit_tests/extractor/intersection_analysis_tests.cpp | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/extractor/class_data.hpp b/include/extractor/class_data.hpp index 83aa9669fcb..e4f5dc3a82f 100644 --- a/include/extractor/class_data.hpp +++ b/include/extractor/class_data.hpp @@ -13,9 +13,11 @@ namespace osrm::extractor { using ClassData = std::uint8_t; -constexpr ClassData INAVLID_CLASS_DATA = std::numeric_limits::max(); -static const std::uint8_t MAX_CLASS_INDEX = 8 - 1; -static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 8; +constexpr ClassData INVALID_CLASS_DATA = std::numeric_limits::max(); +static const std::uint8_t MAX_CLASS_INDEX = 7 - 1; +// We can allow for 7 classes, so 0b0111_1111 when all would be set on an edge. +// Setting the MSB would mark is invalid. +static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 7; inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; } diff --git a/include/extractor/profile_properties.hpp b/include/extractor/profile_properties.hpp index 371155b17fc..c848b6be7ad 100644 --- a/include/extractor/profile_properties.hpp +++ b/include/extractor/profile_properties.hpp @@ -30,7 +30,7 @@ struct ProfileProperties weight_name{"duration"}, class_names{{}}, excludable_classes{{}}, call_tagless_node_function(true) { - std::fill(excludable_classes.begin(), excludable_classes.end(), INAVLID_CLASS_DATA); + std::fill(excludable_classes.begin(), excludable_classes.end(), INVALID_CLASS_DATA); BOOST_ASSERT(weight_name[MAX_WEIGHT_NAME_LENGTH] == '\0'); } diff --git a/include/util/exclude_flag.hpp b/include/util/exclude_flag.hpp index 9a61d169cf4..9913f7ae474 100644 --- a/include/util/exclude_flag.hpp +++ b/include/util/exclude_flag.hpp @@ -15,7 +15,7 @@ excludeFlagsToNodeFilter(const NodeID number_of_nodes, std::vector> filters; for (auto mask : properties.excludable_classes) { - if (mask != extractor::INAVLID_CLASS_DATA) + if (mask != extractor::INVALID_CLASS_DATA) { std::vector allowed_nodes(number_of_nodes); for (const auto node : util::irange(0, number_of_nodes)) diff --git a/unit_tests/extractor/intersection_analysis_tests.cpp b/unit_tests/extractor/intersection_analysis_tests.cpp index 79b261ac74c..7f82695dc40 100644 --- a/unit_tests/extractor/intersection_analysis_tests.cpp +++ b/unit_tests/extractor/intersection_analysis_tests.cpp @@ -19,8 +19,8 @@ using Graph = util::NodeBasedDynamicGraph; BOOST_AUTO_TEST_CASE(simple_intersection_connectivity) { std::vector annotations{ - {EMPTY_NAMEID, 0, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}, - {EMPTY_NAMEID, 1, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}}; + {EMPTY_NAMEID, 0, INVALID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}, + {EMPTY_NAMEID, 1, INVALID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}}; std::vector restrictions{TurnRestriction{{ViaNodePath{0, 2, 1}}, false}}; CompressedEdgeContainer container; test::MockScriptingEnvironment scripting_environment; From 7786c8dba00a3657b48bbb44f7309d65b8c9c199 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 9 Jan 2026 14:40:44 +0100 Subject: [PATCH 2/4] Add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9448d5ec97f..989feac285e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,9 @@ - CHANGED: Upgrade Cucumber-js to v12 [#7221](https://github.com/Project-OSRM/osrm-backend/pull/7221) - CHANGED: Add libcap-setcap to alpine dockerfile [#7241](https://github.com/Project-OSRM/osrm-backend/issues/7241) - FIXED: Minor misspellings found in source code, comments and documents [#7215](https://github.com/Project-OSRM/osrm-backend/pull/7215) + - Profile: - FIXED: Use `cycleway:both` if available. [#6179](https://github.com/Project-OSRM/osrm-backend/issues/6179) + - FIXED: Correcly limit exclude classes to 7. [#7322](https://github.com/Project-OSRM/osrm-backend/pull/7322) # 6.0.0 - Changes from 6.0.0 RC2: None From a339f4f038026901162efc346c4cfb09fcd4dc80 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 9 Jan 2026 14:59:18 +0100 Subject: [PATCH 3/4] Update include/extractor/class_data.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- include/extractor/class_data.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/extractor/class_data.hpp b/include/extractor/class_data.hpp index e4f5dc3a82f..0913148984b 100644 --- a/include/extractor/class_data.hpp +++ b/include/extractor/class_data.hpp @@ -16,7 +16,7 @@ using ClassData = std::uint8_t; constexpr ClassData INVALID_CLASS_DATA = std::numeric_limits::max(); static const std::uint8_t MAX_CLASS_INDEX = 7 - 1; // We can allow for 7 classes, so 0b0111_1111 when all would be set on an edge. -// Setting the MSB would mark is invalid. +// Setting the MSB would mark it invalid. static const std::uint8_t MAX_EXCLUDABLE_CLASSES = 7; inline bool isSubset(const ClassData lhs, const ClassData rhs) { return (lhs & rhs) == lhs; } From 422cfb9b3b0f01b781b92880447c1a2d18275e8a Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Fri, 9 Jan 2026 14:59:25 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 989feac285e..af4b306dc1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ - FIXED: Minor misspellings found in source code, comments and documents [#7215](https://github.com/Project-OSRM/osrm-backend/pull/7215) - Profile: - FIXED: Use `cycleway:both` if available. [#6179](https://github.com/Project-OSRM/osrm-backend/issues/6179) - - FIXED: Correcly limit exclude classes to 7. [#7322](https://github.com/Project-OSRM/osrm-backend/pull/7322) + - FIXED: Correctly limit exclude classes to 7. [#7322](https://github.com/Project-OSRM/osrm-backend/pull/7322) # 6.0.0 - Changes from 6.0.0 RC2: None