Bit rot in GEGL examples

ForumsFor GEGL developers (read-only) ► Bit rot in GEGL examples

Sent: 2010-02-25 17:23:52 UTC (almost 2 years ago)

From: Klaus Pedersen

Bit rot in GEGL examples

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

_______________________________________________
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer

Welcome!


Lost password?

Not a member? Sign up!

Random tutorials | Latest tutorials

  1. Creating a simple Company Logo Creating a simple Company Logo 24
  2. Smoke and Flames Smoke and Flames 21
  3. Creating a bloody splatter texture Creating a bloody splatter texture 36
  4. Create sparkle on any object! Create sparkle on any object! 25

Latest comments

2.6.12 crashes on startup in windows xp. 2.6.11 works fine. (2 days ago in Last stable 2.6 release: 2.6.12 has arrived)

Thank you! You really helped! The tutorial went great for me! Tha... (5 days ago in [AVATAR] Become a real Na'Vi using GIMP!)

maybe you still selected a channel or so? explicitly click a layer ... (5 days ago in Create cool rifts with translucent lights!)

Poll

Is GIMP an adequate application for you to create printed graphics like flyers, advertisments etc?

Latest forum activities

Your Ad Here

facts & numbers

gimpusers.com RSS feed

48 identi.ca followers
748 Twitter followers

powered by bitfire it services