After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725604 - gegl_buffer_iterator_add fails to flag as INCOMPATIBLE buffers iterated with an offset
gegl_buffer_iterator_add fails to flag as INCOMPATIBLE buffers iterated with ...
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: core
git master
Other Linux
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2014-03-03 18:00 UTC by Massimo
Modified: 2014-03-09 13:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program (2.31 KB, text/x-csrc)
2014-03-03 18:00 UTC, Massimo
  Details
quick hack (2.03 KB, patch)
2014-03-03 18:06 UTC, Massimo
none Details | Review
Fix buffer iterator handling of shifted tiles (bug 725604) (2.49 KB, patch)
2014-03-07 14:43 UTC, Daniel Sabo
none Details | Review
Fix buffer iterator handling of shifted tiles (bug 725604) (2.49 KB, patch)
2014-03-08 07:45 UTC, Daniel Sabo
none Details | Review

Description Massimo 2014-03-03 18:00:16 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.
Comment 1 Massimo 2014-03-03 18:06:55 UTC
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.
Comment 2 Daniel Sabo 2014-03-04 07:29:59 UTC
This seems similar to gegl_buffer_scan_compatible() in gegl-buffer-access.c; I'm not sure about GEGL_REMAINDER vs (abs() % foo).
Comment 3 Daniel Sabo 2014-03-07 14:43:20 UTC
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)
Comment 4 Daniel Sabo 2014-03-08 07:45:11 UTC
Created attachment 271296 [details] [review]
Fix buffer iterator handling of shifted tiles (bug 725604)

Move the abs() to the correct spot.
Comment 5 Massimo 2014-03-08 15:35:54 UTC
(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.
Comment 6 Daniel Sabo 2014-03-09 13:53:58 UTC
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(-)