mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 04:43:22 -05:00
pointSetBoundingRect() passed CV_32F coordinates to cvFloor() without honouring its documented INT_MIN..INT_MAX precondition, so a point set outside the int range collapsed to a 1x1 rect at INT_MIN, while +inf and -inf gave INT_MIN and INT_MAX - an inverted rectangle. The extrema are now searched for in floats, as the vectorized path already did, and floored and saturated to the closest representable bound once, after the reduction. The sides are computed in int64 and clamped to INT_MAX: xmax - xmin + 1 overflows int once the extrema saturate, and did so already for a CV_32S point set spanning the whole int range. Fixes #29837