[gegl] buffer: cast width*height multiplications in _set() and _get() to gsize



commit 651e574d60cfda45a948f7fe7c0245589a4bf88b
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Nov 30 01:38:02 2019 +0100

    buffer: cast width*height multiplications in _set() and _get() to gsize
    
    This permits larger than INT_MAX sized linear buffers to be set and get
    on 64bit systems. On 32bit systems the allocations are likely to fail,
    ops relying on reading and writing the whole extent of the source buffer
    should be changed to process the data bit by bit. This improves issue #221
    and issue gimp#4268 on 64bit systems.

 gegl/buffer/gegl-buffer-access.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 208fc9d51..79cfc31cb 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -428,7 +428,7 @@ gegl_buffer_iterate_write (GeglBuffer          *buffer,
           GeglTile *tile;
           gboolean  whole_tile;
 
-          bp = buf + bufy * buf_stride + bufx * bpx_size;
+          bp = buf + (gsize) bufy * buf_stride + bufx * bpx_size;
 
           if (width + offsetx - bufx < tile_width)
             pixels = (width + offsetx - bufx) - offsetx;
@@ -985,7 +985,7 @@ gegl_buffer_iterate_read_simple (GeglBuffer          *buffer,
           gint      pixels, row, y;
           GeglTile *tile;
 
-          bp = buf + bufy * buf_stride + bufx * bpx_size;
+          bp = buf + (gsize) bufy * buf_stride + bufx * bpx_size;
 
           if (width + offsetx - bufx < tile_width)
             pixels = width - bufx;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]