From: Nicolai Hähnle Date: Fri, 13 May 2016 06:48:04 +0000 (-0500) Subject: mesa/main: fix integer overflows in _mesa_image_offset X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6510e0734563ff8d30e45b8781153367db15cc5b;p=mesa.git mesa/main: fix integer overflows in _mesa_image_offset Found using -fsanitize=undefined. Cc: "11.1 11.2 12.0" Reviewed-by: Brian Paul --- diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 4d6ab6f2b56..a039b51985f 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -151,8 +151,8 @@ _mesa_image_offset( GLuint dimensions, if (type == GL_BITMAP) { /* BITMAP data */ - GLint bytes_per_row; - GLint bytes_per_image; + GLintptr bytes_per_row; + GLintptr bytes_per_image; /* components per pixel for color or stencil index: */ const GLint comp_per_pixel = 1; @@ -170,8 +170,8 @@ _mesa_image_offset( GLuint dimensions, } else { /* Non-BITMAP data */ - GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; - GLint topOfImage; + GLintptr bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; + GLintptr topOfImage; bytes_per_pixel = _mesa_bytes_per_pixel( format, type );