Fixes sign mismatch in Nearest limit comparison
This commit is contained in:
parent
70ee624e5c
commit
bf2b1a64b9
@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/numeric/conversion/cast.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -26,7 +27,8 @@ Status NearestPlugin::HandleRequest(const api::NearestParameters ¶ms,
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(params.IsValid());
|
BOOST_ASSERT(params.IsValid());
|
||||||
|
|
||||||
if (params.number_of_results > max_results)
|
if (max_results > 0 &&
|
||||||
|
(boost::numeric_cast<std::int64_t>(params.number_of_results) > max_results))
|
||||||
{
|
{
|
||||||
return Error("TooBig",
|
return Error("TooBig",
|
||||||
"Number of results " + std::to_string(params.number_of_results) +
|
"Number of results " + std::to_string(params.number_of_results) +
|
||||||
|
Loading…
Reference in New Issue
Block a user