The imageproc library contained a vulnerability due to a fragile bounds check when sampling pixels from an image. The code attempted to constrain coordinates within image bounds by adding a constant to an input coordinate and taking the minimum with 'dimension - 1', but this approach did not prevent integer overflow. As a result, malicious inputs could cause coordinate calculations to exceed image bounds, allowing out-of-bounds pixel reads.