GNOME Bugzilla – Bug 85029
crash when paste text including more than one sections of manpage from Yelp
Last modified: 2004-12-22 21:47:04 UTC
Description of Problem: This is a sure way to kill gnome-terminal on my machine. Steps to reproduce the problem: 1. open yelp. go to a man page, for example, "time(2)" 2. select a large block of text including some hyperlinks (from TIME to DESCRIPTION) with your mouse 3. press your middle mouse button to paste them into gnome-terminal Actual Results: Oops, gnome-terminal dies:-( The following is copied from screen: wangx@pong:~$ gnome-terminal (gnome-terminal:1120): Gdk-WARNING **: Error converting from UTF-8 to STRING: Invalid byte sequence in conversion input Segmentation fault (core dumped) wangx@pong:~$ bug-buddy Expected Results: it shouldn't die How often does this happen? everytime Additional Information: I'm runnning woody + gnome2 built with v-b-s. I didn't set LOCALE manually.
This works fine here- can you please attach a stack trace of the crash?
Is this what you need? wangx@pong:~$ gdb gnome-terminal core .... (gdb) backtrace
+ Trace 23724
Yes, it is, thanks. What version of libzvt do you have installed? I'm told that version 1.117.0 of libzvt corrected a very similar crash. Can you recompile with that and report the result?
I recompiled 'libzvt ' and 'profterm' module from anoncvs with v-b-s just now. It's libzvt 1.117.0 now, but it still crashes. After more experiments, it seems to have nothing to do with hyperlinks or size of the text block. What causes the crash is the invisible trailing characters at the end of each section of a man page. Therefore, I changed the summary of this bug.
Oh, and /that/ one should be fixed in 1.999 :) Can you try to upgrade and build one more time, to test? we do appreciate it...
it still crashes, with libzvt-1.99999.0 and gnome-terminal-2.0 and new yelp (all built from anoncvs with v-b-s just now)
I found the reason for the crash. In libzvt paste_recieved() gdk_utf8_to_string_target call fails, returning NULL when the yelp contents are pasted. And the crash occurs when the return value (NULL) is passed to strlen. Now, gdk_utf8_to_string_target call fails because the copied text (from clip-board) is not a valid utf8 string. This, when it's copied from YELP (the text contains junk characters at the end of each section). What I have done is validating the incoming text for proper utf8 string(using g_utf8_validate()). If not, the junk characters are stripped (replaced with a blank space) and then passed to gdk_utf8_to_string_target call. Not only this prevents the crash and allows the copied text to be pasted, but also bullet-proofs terminal to any misbehaving application.
Created attachment 9327 [details] [review] proposed patch
this patch looks good (haven't tried it though). however, i don't want to make it this late in the release cycle. i'll make a 2.0.0, then commit this on HEAD. if it doesn't cause any instabilities i'll make a release in a week or two probably. also, why is yelp offering non-UTF-8 text?
thanks, committed to CVS: 2002-06-19 Pasupathi Duraisamy <pasupathi.duraisamy@wipro.com> * libzvt/zvtterm.c (paste_received): Handling non-printable characters from yelp contents. Fixes bug #85029.
*** Bug 91224 has been marked as a duplicate of this bug. ***