createCLAHE and setTilesGridSize accepted a tile grid with a zero in it, and CLAHE_Impl::apply then divided by the number of tiles, which crashed. Check that both numbers of tiles are positive in apply, after the type check. This is the same change and the same test as #31109 on 4.x, in test_histograms.cpp because 5.x has no test_clahe.cpp.