$OpenBSD: patch-Modules_rgbimgmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $
--- Modules/rgbimgmodule.c.orig	Thu Feb 14 22:26:18 2008
+++ Modules/rgbimgmodule.c	Tue Aug  5 18:18:52 2008
@@ -299,6 +299,11 @@ longimagedata(PyObject *self, PyObject *args)
 	xsize = image.xsize;
 	ysize = image.ysize;
 	zsize = image.zsize;
+	tablen = xsize * ysize * zsize * sizeof(Py_Int32);
+        if (xsize != (((tablen / ysize) / zsize) / sizeof(Py_Int32))) {
+		PyErr_NoMemory();
+		goto finally;
+        }
 	if (rle) {
 		tablen = ysize * zsize * sizeof(Py_Int32);
 		rlebuflen = (int) (1.05 * xsize +10);
