GNOME Bugzilla – Bug 725604
gegl_buffer_iterator_add fails to flag as INCOMPATIBLE buffers iterated with an offset
Last modified: 2014-03-09 13:53:58 UTC
Created attachment 270824 [details] test program On my system, running the attached program, valgrind prints: ==7192== Invalid write of size 1 ==7192== at 0x400B69: main (/home/massimo/devel/tmp/test-gegl.13.c:26) ==7192== Address 0x107038e2 is not stack'd, malloc'd or (recently) free'd ==7192== ==7192== Invalid write of size 1 ==7192== at 0x400B6F: main (/home/massimo/devel/tmp/test-gegl.13.c:26) ==7192== Address 0x107038e1 is not stack'd, malloc'd or (recently) free'd ==7192== ==7192== Invalid write of size 1 ==7192== at 0x400B75: main (/home/massimo/devel/tmp/test-gegl.13.c:26) ==7192== Address 0x107038e0 is not stack'd, malloc'd or (recently) free'd ==7192== valgrind: m_mallocfree.c:277 (mk_plain_bszB): Assertion 'bszB != 0' failed. valgrind: This is probably caused by your program erroneously writing past the end of a heap block and corrupting heap metadata. If you fix any invalid writes reported by Memcheck, this assertion failure will probably go away. Please try that before reporting this as a bug. Running the same program built using git gegl-0-2 branch, valgrind doesn't show any error.
Created attachment 270825 [details] [review] quick hack After patching gegl master with the attached quick hack, valgrind doesn't show any error and the composition attached to Bug 724852 renders fine and the seamless clone tool does not crash GIMP, at least, not in my few tests.
This seems similar to gegl_buffer_scan_compatible() in gegl-buffer-access.c; I'm not sure about GEGL_REMAINDER vs (abs() % foo).
Created attachment 271239 [details] [review] Fix buffer iterator handling of shifted tiles (bug 725604) How about this? (logic mostly taken from the code in gegl-buffer-access.c)
Created attachment 271296 [details] [review] Fix buffer iterator handling of shifted tiles (bug 725604) Move the abs() to the correct spot.
(In reply to comment #4) > Created an attachment (id=271296) [details] [review] > Fix buffer iterator handling of shifted tiles (bug 725604) > > Move the abs() to the correct spot. with this patch valgrind is happy and also it is possible to render the composition attached to Bug 724852.
commit 421d1e82a181b0b5b17a845944aeff42492d977e Author: Daniel Sabo <DanielSabo@gmail.com> Date: Fri Mar 7 05:08:09 2014 -0800 Fix buffer iterator handling of shifted tiles (bug 725604) Previous code didn't correctly account for buffer shift when the iterations had different rects. gegl/buffer/gegl-buffer-iterator.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)