Opened 7 years ago

#11679 new Bugs

boost::polygon::connectivity_extraction<int>::extract crashes when no polygons were inserted

Reported by: mhilferink@… Owned by: Lucanus Simonson
Milestone: To Be Determined Component: polygon
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

steps to reproduce:

#include <boost/polygon/polygon.hpp>
int main() {
  boost::polygon::connectivity_extraction<int> ce;
  std::vector<std::set<int> > graph;
  ce.extract(graph); // causes access violation
}

The debugger indicates an access violation in

    template <typename iT>
    static inline void compute_histogram_in_y(iT begin, iT end, std::size_t size, std::vector<std::pair<Unit, std::pair<std::size_t, std::size_t> > >& histogram);

Apparently, the original coder assumed (incorrectly?) that the given size != 0.

a simple 'if' would probably resolve this I do in my client code as well. I just wonder what the best level would be to introduce this if:

  • connectivity_extraction::extract
  • arbitrary_connectivity_extraction::execute
  • or better in boost::polygon::line_intersection<T>::validate_scan ?

Change History (0)

Note: See TracTickets for help on using tickets.