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 343562 - Garbage in dialog when error occurs while trying to play a song
Garbage in dialog when error occurs while trying to play a song
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: User Interface
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 351526 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-06-01 07:01 UTC by Sylvain Defresne
Modified: 2006-08-16 01:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
No longer interpret %-escape sequence in primary (893 bytes, patch)
2006-06-01 07:05 UTC, Sylvain Defresne
none Details | Review
more format string problems (4.87 KB, patch)
2006-06-01 22:38 UTC, Jonathan Matthew
committed Details | Review

Description Sylvain Defresne 2006-06-01 07:01:48 UTC
In the function rb_shell_player_cmd_play(), if an error occur when calling rb_shell_player_playpause(), a dialog is displayed using rb_error_dialog(). However, the first string passed to this function contains a "%s" escape sequence, even tough is is later passed to gtk_message_dialog_new() without further arguments, and thus interpreting a random address in memory as a string, which can lead to crash or whatever ...

The two attached patch correct this problem, first by changing the string passed to rb_error_dialog() to remove the "%s" sequence, and then by changing the call to gtk_message_dialog_new() in rb_error_dialog() to not interpret %-escape sequences in primary string.
Comment 1 Sylvain Defresne 2006-06-01 07:05:30 UTC
Created attachment 66579 [details] [review]
No longer interpret %-escape sequence in primary

Well, I promised two patch, but there will only be one. The two changes are incoporated in this single patch.
Comment 2 Jonathan Matthew 2006-06-01 22:38:37 UTC
Created attachment 66627 [details] [review]
more format string problems

This fixes all other instances of the same mistake, marks the rb_dialog functions as taking format string args so gcc will help catch future problems, and then does the same for rb_debug.
Comment 3 James "Doc" Livingston 2006-06-02 01:41:33 UTC
Looks great to me, except that it probably needs something so that it works on non-GCC compilers. Putting the following somewhere will probably work.

#ifndef G_GNUC_PRINTF
#define G_GNUC_PRINTF (a,b)
#endif
Comment 4 Sylvain Defresne 2006-06-02 06:46:31 UTC
Concerning G_GNUC_PRINTF, this is already a macro defined by glib [1] to expand to the correct syntax if the compiler used is gcc, and to nothing if it isn't, so adding the #ifndef ... is not necessary.

[1] http://developer.gnome.org/doc/API/2.0/glib/glib-Miscellaneous-Macros.html#id3046072

Concerning the second patch, it has removed my modification to rb_error_dialog() that protected the call to gtk_message_dialog_new() against %-escape sequence in the primary parameter. Better safe than sorry :-)
Comment 5 Sylvain Defresne 2006-06-02 06:47:52 UTC
Oups, sorry the link should have been [1]. Sorry for the spam.

[1] http://developer.gnome.org/doc/API/2.0/glib/glib-Miscellaneous-Macros.html#id3045876
Comment 6 James "Doc" Livingston 2006-06-02 13:53:24 UTC
Good point, I hadn't noticed that it was a glib macro. AFAICT the rb_error_dialog change is still in the patch.
Comment 7 Jonathan Matthew 2006-06-02 22:28:16 UTC
Committed to cvs.
Comment 8 James "Doc" Livingston 2006-08-16 01:29:50 UTC
*** Bug 351526 has been marked as a duplicate of this bug. ***