From 5d8ab389f8a475e486080d698325d434e14aec2f Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Fri, 19 Dec 2025 16:59:18 +0100 Subject: [PATCH] Fix potential overflow Fixes https://g-issues.oss-fuzz.com/issues/470321412 --- modules/imgcodecs/src/grfmt_png.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp index eb3f22796b..e1e5d9a710 100644 --- a/modules/imgcodecs/src/grfmt_png.cpp +++ b/modules/imgcodecs/src/grfmt_png.cpp @@ -509,7 +509,7 @@ bool PngDecoder::readData( Mat& img ) dop = chunk.p[32]; bop = chunk.p[33]; - if (int(x0 + w0) > img.cols || int(y0 + h0) > img.rows || dop > 2 || bop > 1) + if ((int64_t)x0 + w0 > img.cols || (int64_t)y0 + h0 > img.rows || dop > 2 || bop > 1) { return false; }