geojson.input - check and throw if bounding box extrator returns no boxes and not all input consumed (preserve 3.0.x caps)

This commit is contained in:
Artem Pavlenko 2017-09-11 17:28:09 +01:00
parent ebb8d3b3ed
commit 6e9c56ee2c

View file

@ -272,6 +272,7 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
try
{
mapnik::json::extract_bounding_boxes(itr, end, boxes);
if (itr != end || boxes.empty()) throw std::exception();
// bulk insert initialise r-tree
tree_ = std::make_unique<spatial_index_type>(boxes);
// calculate total extent
@ -363,9 +364,7 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
{
boxes_type boxes;
mapnik::json::extract_bounding_boxes(itr, end, boxes);
if (itr != end) throw std::runtime_error("Malformed GeoJSON"); //ensure we've consumed all input
if (itr != end || boxes.empty()) throw std::exception(); //ensure we've consumed all input and we extracted at least one bbox;
for (auto const& item : boxes)
{
auto const& geometry_index = std::get<1>(item);