Issue #24264: Fixed buffer overflow in the imageop module.
diff --git a/Modules/imageop.c b/Modules/imageop.c
index 8bd11b2..b91f967 100644
--- a/Modules/imageop.c
+++ b/Modules/imageop.c
@@ -50,8 +50,11 @@
         return 0;
     if ( !check_coordonnate(y, yname) )
         return 0;
-    if ( size == (product / y) / x )
-        return 1;
+    if ( product % y == 0 ) {
+        product /= y;
+        if ( product % x == 0 && size == product / x )
+            return 1;
+    }
     PyErr_SetString(ImageopError, "String has incorrect length");
     return 0;
 }