[gegl/abyss] buffer: fixed memory bug in CLAMP abyss policy
- From: Ville Sokk <villesokk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/abyss] buffer: fixed memory bug in CLAMP abyss policy
- Date: Sun, 8 Jul 2012 17:13:05 +0000 (UTC)
commit 7d2b60a7a64731b1af1930c4b49fdf83a92b0e5d
Author: Ville Sokk <ville sokk gmail com>
Date: Sun Jul 8 20:00:08 2012 +0300
buffer: fixed memory bug in CLAMP abyss policy
gegl/buffer/gegl-buffer-access.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 6851b16..7aecf18 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -970,13 +970,13 @@ gegl_buffer_iterate_read_abyss_clamp (GeglBuffer *buffer,
{ /* x was clamped. Copy a single color since x remains clamped in
this iteration. */
guchar color[128];
- gint i;
+ gint i;
/* gap between current column and left side of abyss rect */
lskip = (buffer_abyss_x) - (buffer_x + bufx);
/* gap between current column and end of roi */
rskip = width - bufx;
- pixels = (lskip > 0) ? lskip : rskip;
+ pixels = (lskip > 0 && lskip < width) ? lskip : rskip;
if (row_in_abyss)
{ /* y remains clamped in this iteration so don't change the color */
@@ -1008,8 +1008,8 @@ gegl_buffer_iterate_read_abyss_clamp (GeglBuffer *buffer,
for (i = 0; i < pixels * bpx_size; i += bpx_size)
memcpy (bp + i, color, bpx_size);
- if (buffer_y + y >= buffer_abyss_y
- && buffer_y + y < abyss_y_total - 1)
+ if (buffer_y + y >= buffer_abyss_y &&
+ buffer_y + y < abyss_y_total - 1)
tp += tile_stride;
bp += buf_stride;
}
@@ -1036,8 +1036,8 @@ gegl_buffer_iterate_read_abyss_clamp (GeglBuffer *buffer,
else
memcpy (bp, tp, pixels * px_size);
- if (buffer_y + y >= buffer_abyss_y
- && buffer_y + y < abyss_y_total - 1)
+ if (buffer_y + y >= buffer_abyss_y &&
+ buffer_y + y < abyss_y_total - 1)
tp += tile_stride;
bp += buf_stride;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]