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 /src/cairo-script-surface.c | |
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 'src/cairo-script-surface.c')
-rw-r--r-- | src/cairo-script-surface.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index ea0117dab..91e4baae7 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -1202,7 +1202,8 @@ static cairo_status_t _write_image_surface (cairo_output_stream_t *output, const cairo_image_surface_t *image) { - int stride, row, width; + int row, width; + ptrdiff_t stride; uint8_t row_stack[CAIRO_STACK_BUFFER_SIZE]; uint8_t *rowdata; uint8_t *data; |