From 3f8c1d650e99dcaa5222d998918702d369453462 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Thu, 4 Aug 2022 15:53:42 +0200 Subject: [PATCH 1/2] Remove highway=bicycle safety bonys This removes a bonus for a road class that doesn't exist (cycleway would be correct), but the code was buggy since safety_bonus is nil and caused an arithmetic exception. We only caught this 4 (!) years later since recently a way was tagged with highway=bicycle and made it in our OSM data leading to preprocessing failures. --- profiles/bicycle.lua | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index 223954f0219..58740db48b8 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -543,21 +543,6 @@ function safety_handler(profile,way,result,data) if result.duration > 0 then result.weight = result.duration / forward_penalty end - - if data.highway == "bicycle" then - safety_bonus = safety_bonus + 0.2 - if result.forward_speed > 0 then - -- convert from km/h to m/s - result.forward_rate = result.forward_speed / 3.6 * safety_bonus - end - if result.backward_speed > 0 then - -- convert from km/h to m/s - result.backward_rate = result.backward_speed / 3.6 * safety_bonus - end - if result.duration > 0 then - result.weight = result.duration / safety_bonus - end - end end end From e50a7ca414569cd1bc7cfe28bfffe7bfc75aef1c Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Thu, 4 Aug 2022 15:57:01 +0200 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0189fb507b1..b71ccc15794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) - Misc: - FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285) + - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296) - Build: - CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290) - CHANGED: Use Conan instead of Mason to install code dependencies. [#6284](https://github.com/Project-OSRM/osrm-backend/pull/6284)