GNOME Bugzilla – Bug 405006
zenity --text-info --editable crashes on files with printf-formatted strings
Last modified: 2007-05-14 22:13:10 UTC
This bug has been opened here: https://launchpad.net/ubuntu/+source/zenity/+bug/83549 Zenity segfaults if used in editable mode with files that contain special printf format strings. If we escape format strings (e.g. via sed) nothing More detailed information available in the Ubuntu bugreport.
Debug backgtrace: Program received signal SIGSEGV, Segmentation fault.
+ Trace 108464
Thread NaN (LWP 14461)
Created attachment 82037 [details] [review] Patch to fix issue with printf format string There might be an easier way to do this, however I could not find a glib function for replacing strings.
Created attachment 82066 [details] [review] Simply do g_print ("%s", string_possibly_containing_percent_chars);
Maybe using "%s\n" as the format string is better?
g_print ("%s", string_possibly_containing_percent_chars); should be enough. "%s\n" is an overkill. i see no need in extra chars to be appened (this may lead to unneeded file growth, if used as an "editor").
FWIW this patch looks reasonable to me (not that this means anything official :-). It also seems to fix a memory leak.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report. 2007-05-15 Lucas Rocha <lucasr@gnome.org> * src/text.c (zenity_text_dialog_response): fix seg fault when outputing files with special printf format strings (Fixes bug #405006). Patch from Mariano Suárez-Alvarez.