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 85029 - crash when paste text including more than one sections of manpage from Yelp
crash when paste text including more than one sections of manpage from Yelp
Status: RESOLVED FIXED
Product: libzvt
Classification: Deprecated
Component: general
unspecified
Other Linux
: High critical
: ---
Assigned To: jacob berkman
Unknown User
: 91224 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-06-12 15:03 UTC by Xing Wang
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.0


Attachments
proposed patch (2.41 KB, patch)
2002-06-19 15:42 UTC, Pasupathi
none Details | Review

Description Xing Wang 2002-06-12 15:03:23 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.
Comment 1 Luis Villa 2002-06-12 16:56:33 UTC
This works fine here- can you please attach a stack trace of the crash?
Comment 2 Xing Wang 2002-06-12 18:08:26 UTC
Is this what you need?

wangx@pong:~$ gdb gnome-terminal core
....
(gdb) backtrace 
  • #0 paste_received
  • #1 request_text_received_func
    at gtkclipboard.c line 685
  • #2 selection_received
    at gtkclipboard.c line 598
  • #3 _gtk_marshal_VOID__BOXED_UINT
    at gtkmarshalers.c line 969
  • #4 g_closure_invoke
    at gclosure.c line 437
  • #5 signal_emit_unlocked_R
    at gsignal.c line 2341
  • #6 g_signal_emit_valist
    at gsignal.c line 2100
  • #7 gtk_signal_emit_by_name
    at gtksignal.c line 374
  • #8 gtk_selection_retrieval_report
  • #9 gtk_selection_notify
    at gtkselection.c line 1466
  • #10 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 82
  • #11 g_type_class_meta_marshal
    at gclosure.c line 514
  • #12 g_closure_invoke
    at gclosure.c line 437
  • #13 signal_emit_unlocked_R
    at gsignal.c line 2379
  • #14 g_signal_emit_valist
    at gsignal.c line 2110
  • #15 gtk_signal_emit
    at gtksignal.c line 355
  • #16 gtk_widget_event_internal
  • #17 gtk_widget_event
    at gtkwidget.c line 2943
  • #18 gtk_main_do_event
    at gtkmain.c line 1360
  • #19 gdk_event_dispatch
    at gdkevents-x11.c line 1762
  • #20 g_main_dispatch
    at gmain.c line 1617
  • #21 g_main_context_dispatch
    at gmain.c line 2161
  • #22 g_main_context_iterate
    at gmain.c line 2242
  • #23 g_main_loop_run
    at gmain.c line 2462
  • #24 gtk_main
    at gtkmain.c line 936
  • #25 main
    at terminal.c line 1167
  • #26 __libc_start_main
    from /lib/libc.so.6

Comment 3 Luis Villa 2002-06-12 19:15:18 UTC
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?
Comment 4 Xing Wang 2002-06-12 19:51:57 UTC
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.
Comment 5 Luis Villa 2002-06-13 16:43:52 UTC
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...
Comment 6 Xing Wang 2002-06-13 17:24:23 UTC
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)
Comment 7 Pasupathi 2002-06-19 15:41:22 UTC
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.

Comment 8 Pasupathi 2002-06-19 15:42:14 UTC
Created attachment 9327 [details] [review]
proposed patch
Comment 9 jacob berkman 2002-06-19 17:43:09 UTC
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?
Comment 10 jacob berkman 2002-06-19 19:20:19 UTC
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.
Comment 11 Luis Villa 2002-08-22 18:14:01 UTC
*** Bug 91224 has been marked as a duplicate of this bug. ***