GNOME Bugzilla – Bug 314820
Application crashes when default icon is too large
Last modified: 2007-01-25 19:50:51 UTC
Steps to reproduce: The little program at the end of the description reproduces the problem 1. Create an icon larger than 255x255 and save as png 2. Set this icon to be the only icon for the application with gtk_window_set_default_icon_list 3. Open the main window and see the icon work properly 4. Open a dialog window and the program crashes with an X Window System error. --- cut here --- /****************************************************************************** * Program to test icons * * 1. Build the program * 2. Create several icons with sizes like 8x8, 32x32, 256x256, 1024x1024 * 3. Run the program * ./progname <iconfile> * 4. Press the button to check the icon of the message *****************************************************************************/ #include <glib.h> #include <gtk/gtk.h> static void dia(void) { GtkWidget *ad; ad = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "If you can read this message, the icon is fine!"); gtk_dialog_run(GTK_DIALOG(ad)); gtk_widget_destroy(ad); } gint main (gint argc, gchar *argv[]) { gchar *app_icon = NULL; /* Name of program */ GtkWidget *win; /* Main application window */ gtk_init(&argc, &argv); if (argc == 2) app_icon = argv[1]; if (app_icon) { GdkPixbuf *pixbuf; // Pixbuf with icon GList *list; // List of icons pixbuf = gdk_pixbuf_new_from_file(app_icon, NULL); if (!pixbuf) g_warning("Problems loading icon %s", app_icon); else { list = g_list_append(NULL, pixbuf); gtk_window_set_default_icon_list(list); } } win = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(win), "delete-event", G_CALLBACK(gtk_main_quit), NULL); { GtkWidget *but; but = gtk_button_new_with_label("Click me (and pray)"); gtk_container_add(GTK_CONTAINER(win), but); g_signal_connect(G_OBJECT(but), "clicked", G_CALLBACK(dia), NULL); } /* Set the values of some fields */ gtk_widget_show_all(win); gtk_main(); return 1; } Stack trace: Sorry, didn't manage to get a real stack trace yet... > ./t 511.png The program 't' received an X Window System error. This probably reflects a bug in the program. The error was 'BadLength (poly request too large or internal Xlib length erro'. (Details: serial 1358 error_code 16 request_code 18 minor_code 0) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) Other information: System I'm using is the default FC4 system with updates applied.
You are probably running into a the max request size, since the icons are all stored in one big property. Not really worth doing anything about it, though. Or do you really want to use 1024x1024 size icons ?
The only reason for fixing this might be to avoid malicious programs to be able to install icons in the user's home directory with a ridiculous size and so crash the program (I'm not even sure this is possible with Gnome, but it sounds plausible to me). I must admit that I was actually using an icon of nearly that size ;-). Just a little bit too lazy to scale down the icon.
*** Bug 337622 has been marked as a duplicate of this bug. ***