diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2016-10-20 21:12:30 +1030 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2017-11-07 17:01:49 -0800 |
commit | 38fbe621cf80d560cfc27b54b5417b62cda64c8a (patch) | |
tree | c6fc5177933c3ebb368e7531eb187ba994ae97a4 /boilerplate | |
parent | 35fccff6ec393ccca3d3ced79093ca491ce32df4 (diff) | |
download | cairo-38fbe621cf80d560cfc27b54b5417b62cda64c8a.tar.gz |
image: prevent invalid ptr access for > 4GB images
Image data is often accessed using:
image->data + y * image->stride
On 64-bit achitectures if the image data is > 4GB, this computation
will overflow since both y and stride are 32-bit types.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98165
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index 7fdbf798b..4804deaff 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -42,6 +42,7 @@ #undef CAIRO_VERSION_H #include "../cairo-version.h" +#include <stddef.h> #include <stdlib.h> #include <ctype.h> #include <assert.h> @@ -976,7 +977,8 @@ cairo_surface_t * cairo_boilerplate_image_surface_create_from_ppm_stream (FILE *file) { char format; - int width, height, stride; + int width, height; + ptrdiff_t stride; int x, y; unsigned char *data; cairo_surface_t *image = NULL; |