Hi,
On Klaus Wrote to the gmame robot:
No I am not top-posting!
Recently I have been playing with GEGL, the api and design is easy enough but
unfortunately the examples doesn't compile/run any more.
For example:
examples/hello-world.c:
GeglNode *display = gegl_node_create_child (gegl, "gegl:display");
and
examples/hello-world-video.c:
GeglNode *display = gegl_node_new_child (gegl, "operation",
"gegl:ff-save", "path", "test.avi", "bitrate", 1200000.0, NULL);
With these two examples you get runtime errors complaining about the operations
"gegl:display" and "gegl:ff-save" are unknown.
examples/gegl-paint.c:
Running ./paint without parameters terminate with a buffer overflow.
I tried to trace it. Here is how it looks with function traces:
$ ./paint
...
expose_event:441
gegl_view_repaint:505
gegl_view_repaint:511 (roi={0,0,513,513})
*** buffer overflow detected ***: ./paint terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x3b4c4f75e7]
/lib64/libc.so.6[0x3b4c4f5600]
/usr/lib64/libgegl-0.0.so.0(gegl_buffer_header_init+0x54)
Notice that the repaint area in "gegl_view_repaint()" is bigger
than the allocated area. To fix it we can change gegl_view_repaint():
void
gegl_view_repaint (GeglView *view)
{
GtkWidget *widget = GTK_WIDGET (view);
GeglViewPrivate *priv = GEGL_VIEW_GET_PRIVATE (view);
GeglRectangle roi;
GtkAllocation allocation;
roi.x = priv->x / priv->scale;
roi.y = priv->y / priv->scale;
gtk_widget_get_allocation (widget, &allocation);
roi.width = ceil(allocation.width / priv->scale+1);
roi.height = ceil(allocation.height / priv->scale+1);
Should probably be changed to:
+ roi.width = ceil(allocation.width / priv->scale);
+ roi.height = ceil(allocation.height / priv->scale);
Making this change make the program run a little longer. But still
crash after flashing the window on the screen:
$ ./paint
...
gegl_view_class_init:105
gegl_view_init:176
gegl_view_repaint:513
gegl_view_repaint:519 (roi={0,0,1,1})
expose_event:447
gegl_view_repaint:513
gegl_view_repaint:519 (roi={0,0,512,512})
*** buffer overflow detected ***: ./paint terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x3b4c4f75e7]
/lib64/libc.so.6[0x3b4c4f5600]
/usr/lib64/libgegl-0.0.so.0(gegl_buffer_header_init+0x54)[0x34b421b684]
/usr/lib64/libgegl-0.0.so.0[0x34b4226bff]
/usr/lib64/libgegl-0.0.so.0[0x34b4227cd6]
/usr/lib64/libgegl-0.0.so.0[0x34b4229f04]
/usr/lib64/libgegl-0.0.so.0(gegl_tile_store+0x8a)[0x34b422517a]
After removing the call to gegl_buffer_linear_close (buffer, buf)
in main() - the program executes without buffer overflows (why??).
buf = gegl_buffer_linear_open(buffer, NULL, NULL, babl_format("Y' u8"));
/* it would be useful to have a programmatic way of doing this */
memset (buf, 100, 512 * 512);
// gegl_buffer_linear_close (buffer, buf);
The program can run, but nothing happens on the screen (it's black)...
BR, Klaus