Skip to content

Commit

Permalink
Distance table plugin, set maximum size of input before truncation fr…
Browse files Browse the repository at this point in the history
…om cmake Project-OSRM#1077
  • Loading branch information
frodrigo committed Oct 22, 2014
1 parent b095aae commit c3b46f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,10 @@ if(BUILD_DEBIAN_PACKAGE)
include(CPackDebianConfig)
include(CPack)
endif()

set(DISTANCE_TABLE_PLUGIN_MAX_LOCATIONS 100 CACHE STRING "Distance table plugin, maximum size of input before truncation")
if(NOT DISTANCE_TABLE_PLUGIN_MAX_LOCATIONS MATCHES "^[0-9]+$")
message(FATAL_ERROR "DISTANCE_TABLE_PLUGIN_MAX_LOCATIONS must be a number")
else()
add_definitions(-DDISTANCE_TABLE_PLUGIN_MAX_LOCATIONS=${DISTANCE_TABLE_PLUGIN_MAX_LOCATIONS})
endif()
2 changes: 1 addition & 1 deletion Plugins/DistanceTablePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin

const bool checksum_OK = (route_parameters.check_sum == raw_route.check_sum);
unsigned max_locations =
std::min(100u, static_cast<unsigned>(raw_route.raw_via_node_coordinates.size()));
std::min(static_cast<unsigned>(DISTANCE_TABLE_PLUGIN_MAX_LOCATIONS), static_cast<unsigned>(raw_route.raw_via_node_coordinates.size()));
PhantomNodeArray phantom_node_vector(max_locations);
for (unsigned i = 0; i < max_locations; ++i)
{
Expand Down

0 comments on commit c3b46f0

Please sign in to comment.