Skip to content

Overflow LBL_MAX in mln::labeling::blobs

Issue reported by @jonathan.fabrizio

To reproduce:

auto res = mln::labeling::blobs<unsigned int>(ima, nbh, nlbl);

Fail with the following error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Detected overflow in the number of labels.
Aborted (core dumped)

Reason:

Overflow of LBL_MAX which is int, std::numeric_limits<unsigned int>::max() greater than MAX_INT, so LBL_MAX = -1.