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 305467 - gcalctool crashes when given an invalid user function number.
gcalctool crashes when given an invalid user function number.
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
5.5.x
Other All
: High critical
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2005-05-25 19:14 UTC by Peter
Modified: 2005-05-26 17:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix crash with dismissal via mouse click (574 bytes, text/plain)
2005-05-25 20:13 UTC, Rich Burridge
Details

Description Peter 2005-05-25 19:14:18 UTC
Steps to reproduce:
1. start gcalctool 
2. start to play with your keyboard and input as many letters as you can 
3. crash 
 

Stack trace:
(gdb) r 
Starting program: /home/peter/1-gcalc/gcalctool-5.5.42/gcalctool/gcalctool 
[Thread debugging using libthread_db enabled] 
[New Thread -1224296768 (LWP 14185)] 
 
gcalctool: functions.c:900: do_function: Assertion `v->current->value[0] <= 
'9'' failed. 
 
Program received signal SIGABRT, Aborted. 
[Switching to Thread -1224296768 (LWP 14185)] 
0xffffe410 in __kernel_vsyscall () 
(gdb) 
(gdb) bt 
  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/tls/libc.so.6
  • #2 abort
    from /lib/tls/libc.so.6
  • #3 __assert_fail
    from /lib/tls/libc.so.6
  • #4 do_function
    at functions.c line 900
  • #5 do_pending
    at functions.c line 1236
  • #6 button_proc
    at gtk.c line 634
  • #7 check_vals
    at gtk.c line 1799
  • #8 kframe_key_press_cb
    at gtk.c line 1845
  • #9 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #10 ??
  • #11 ??
  • #12 ??
  • #13 ??
    from /usr/lib/libgobject-2.0.so.0
  • #14 ??
  • #15 ??
  • #16 ??
  • #17 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #18 ??
  • #19 ??
  • #20 ??
  • #21 ??
  • #22 ??
  • #23 ??
  • #24 ??
  • #25 g_value_reset
    from /usr/lib/libgobject-2.0.so.0
  • #26 ??
  • #27 ??
  • #28 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #29 ??
    from /usr/lib/libgobject-2.0.so.0
  • #30 ??
  • #31 ??
  • #32 ??
  • #33 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #34 ??
  • #35 ??
  • #36 ??
  • #37 ??
  • #38 ??
  • #39 ??
  • #40 ??
  • #41 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #42 ??
  • #43 ??
  • #44 ??
  • #45 ??
    from /usr/lib/libgobject-2.0.so.0
  • #46 ??
  • #47 ??
  • #48 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #49 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #50 ??
  • #51 g_hash_table_lookup
    from /usr/lib/libglib-2.0.so.0
  • #52 ??
  • #53 g_param_spec_override
    from /usr/lib/libgobject-2.0.so.0
  • #54 ??
  • #55 ??
  • #56 ??
    from /usr/lib/libgobject-2.0.so.0
  • #57 ??
  • #58 ??
  • #59 ??
  • #60 ??
  • #61 ??
  • #62 ??
  • #63 ??
  • #64 ??
  • #65 ??
  • #66 ??
  • #67 ??
  • #68 g_object_steal_data
    from /usr/lib/libgobject-2.0.so.0
  • #69 ??
  • #70 ??
  • #71 ??
  • #72 g_type_value_table_peek
    from /usr/lib/libgobject-2.0.so.0
  • #73 ??
  • #74 ??
  • #75 ??
  • #76 ??
  • #77 ??
  • #78 ??
  • #79 ??
    from /usr/lib/libgobject-2.0.so.0
  • #80 ??
  • #81 ??
  • #82 ??
  • #83 ??
  • #84 ??
  • #85 ??
  • #86 ??
  • #87 ??
  • #88 ??
  • #89 ??
  • #90 ??
  • #91 ??
    from /usr/lib/libgobject-2.0.so.0
  • #92 ??
  • #93 ??
  • #94 ??
  • #95 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #96 ??
  • #97 ??
  • #98 ??
  • #99 ??
  • #100 ??
  • #101 ??
  • #102 ??
  • #103 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #104 ??
  • #105 ??
  • #106 ??
  • #107 ??
  • #108 ??
  • #109 ??
  • #110 ??
  • #111 ??
  • #112 ??
  • #113 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #114 ??
  • #115 ??
  • #116 ??
  • #117 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #118 ??
  • #119 ??
  • #120 ??
  • #121 ??
  • #122 ??
  • #123 XChangeProperty
    from /usr/lib/libX11.so.6
  • #124 ??
  • #125 ??
  • #126 ??
  • #127 ??
  • #128 ??
  • #129 ??
  • #130 ??
  • #131 ??
  • #132 ??
  • #133 ??
  • #134 ??
  • #135 ??
  • #136 ??
  • #137 ??
  • #138 ??
  • #139 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #140 ??
  • #141 ??
  • #142 ??
  • #143 ??
  • #144 ??
  • #145 ??
  • #146 ??
  • #147 ??
  • #148 ??
  • #149 ??
  • #150 ??
  • #151 ??
  • #152 ??
  • #153 ??
  • #154 ??
  • #155 ??
  • #156 ??
  • #157 ??
  • #158 ??
  • #159 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #160 ??
  • #161 ??
  • #162 ??
  • #163 ??
  • #164 ??
  • #165 ??
  • #166 ??
  • #167 ??
  • #168 ??
  • #169 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #170 ??
    from /lib/tls/libc.so.6
  • #171 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #172 ??
  • #173 ??
  • #174 in6addr_any
    from /lib/tls/libc.so.6
  • #175 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #176 ??
  • #177 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #178 ??
    from /lib/tls/libc.so.6
  • #179 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #180 ??
  • #181 ??
  • #182 free
    from /lib/tls/libc.so.6
 

Other information:
I've encounter this bug when I was writing something and using gcalctool. 
 
BTW. After this crash behaviour of gcalctool changed. If before I could see 
something like 4+3*6 now it's works like an ordinary calculator. I can see only 
current number. Is there any possibility to revert this behaviour? And of 
course, it's good idea to have menu item with the possibility to choose 
behavior.
Comment 1 Rich Burridge 2005-05-25 19:21:41 UTC
What version of gcalctool are you running? Do a
Help->About from the menu bar to determine this.
If it's < 5.6.14, could you try the latest by
downloading it from:

 http://ftp.gnome.org/pub/GNOME/sources/gcalctool/5.6/

It looks like you were in "Arithmetic Precedence" mode.
See if the View->Use Arithmetic Precedence menu item is 
checked.

Does the behaviour (i.e. crash) happen in both modes
(When "Use Arithmetic Precedence" is checked and not
checked)?
Comment 2 Rich Burridge 2005-05-25 19:43:10 UTC
Okay, I've worked out what's going on now. The key is:
> functions.c:900: do_function: Assertion `v->current->value[0] <= 
'9'' failed. 

It's failing with you entering a user defined function number that's
not in the range 0-9.

Now there was a little bit of work done in the 5.6.X series of
gcalctool thatfixes this. See bug #172704. That should be fixed in the
5.6.14 version I pointed you at above.

I'm adjusting the summary for this bug to reflect what's really
going on. Speed has nothing to do with it.
Comment 3 Rich Burridge 2005-05-25 20:13:30 UTC
Created attachment 46888 [details]
Fix crash with dismissal via mouse click

There was also a problem if the user dismissed the
function menu with a mouse click rather than via the
Esc key. This patch addresses that problem.
Comment 4 Rich Burridge 2005-05-25 20:38:05 UTC
Changes checked into CVS HEAD. Bumped the version
number in configure.in to 5.6.15. 
Comment 5 Peter 2005-05-26 13:38:49 UTC
Thank you for your attention. 
 
I did not manage to reproduce bug with "Use Arithmetic Precedence" is checked. 
So I assume that I'm not in this mode. 
 
I had 5.5.42 version. Today I've tryed 5.6.14 version. I can reproduce bug. And 
first I reproduced the bug with the previous backtrace (Well. Actually I did 
not manage to see bt, as my keyboard stay locked after 
gcalctool: functions.c:834: do_function: Assertion `v->current->value[0] <= 
'9'' failed.). Now I have another bt: 
 
(gdb) r 
Starting program: /home/peter/1-gcalc/gcalctool-5.6.14/gcalctool/gcalctool 
[Thread debugging using libthread_db enabled] 
[New Thread -1224296768 (LWP 14987)] 
 
(gcalctool:14987): GLib-GObject-CRITICAL **: g_object_get_data: assertion 
`G_IS_OBJECT (object)' failed 
 
Program received signal SIGSEGV, Segmentation fault. 
[Switching to Thread -1224296768 (LWP 14987)] 
show_menu_for_button (widget=0x0, event=0x82c90cc) at gtk.c:2865 
2865        menu = create_menu(n->mtype, n); 
(gdb) 
(gdb) BT 
  • #0 show_menu_for_button
    at gtk.c line 2865
  • #1 do_pending
    at functions.c line 1141
  • #2 button_proc
    at gtk.c line 643
  • #3 check_vals
    at gtk.c line 1819
  • #4 kframe_key_press_cb
    at gtk.c line 1865
  • #5 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #6 ??
  • #7 ??
  • #8 ??
  • #9 ??
    from /usr/lib/libgobject-2.0.so.0
  • #10 ??
  • #11 ??
  • #12 ??
  • #13 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #14 ??
  • #15 ??
  • #16 ??
  • #17 ??
  • #18 ??
  • #19 ??
  • #20 ??
  • #21 g_value_reset
    from /usr/lib/libgobject-2.0.so.0
  • #22 ??
  • #23 ??
  • #24 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #25 ??
    from /usr/lib/libgobject-2.0.so.0
  • #26 ??
  • #27 ??
  • #28 ??
  • #29 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #30 ??
  • #31 ??
  • #32 ??
  • #33 ??
  • #34 ??
  • #35 ??
  • #36 ??
  • #37 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #38 ??
  • #39 ??
  • #40 ??
  • #41 ??
    from /usr/lib/libgobject-2.0.so.0
  • #42 ??
  • #43 ??
  • #44 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #45 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #46 ??
  • #47 g_hash_table_lookup
    from /usr/lib/libglib-2.0.so.0
  • #48 ??
  • #49 g_param_spec_override
    from /usr/lib/libgobject-2.0.so.0
  • #50 ??
  • #51 ??
  • #52 ??
    from /usr/lib/libgobject-2.0.so.0
  • #53 ??
  • #54 ??
  • #55 ??
  • #56 ??
  • #57 ??
  • #58 ??
  • #59 ??
  • #60 ??
  • #61 ??
  • #62 ??
  • #63 ??
  • #64 g_object_steal_data
    from /usr/lib/libgobject-2.0.so.0
  • #65 ??
  • #66 ??
  • #67 ??
  • #68 g_type_value_table_peek
    from /usr/lib/libgobject-2.0.so.0
  • #69 ??
  • #70 ??
  • #71 ??
  • #72 ??
  • #73 ??
  • #74 ??
  • #75 ??
    from /usr/lib/libgobject-2.0.so.0
  • #76 ??
  • #77 ??
  • #78 ??
  • #79 ??
  • #80 ??
  • #81 ??
  • #82 ??
  • #83 ??
  • #84 ??
  • #85 ??
  • #86 ??
  • #87 ??
    from /usr/lib/libgobject-2.0.so.0
  • #88 ??
  • #89 ??
  • #90 ??
  • #91 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #92 ??
  • #93 ??
  • #94 ??
  • #95 ??
  • #96 ??
  • #97 ??
  • #98 ??
  • #99 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #100 ??
  • #101 ??
  • #102 ??
  • #103 ??
  • #104 ??
  • #105 ??
  • #106 ??
  • #107 ??
  • #108 ??
  • #109 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #110 ??
  • #111 ??
  • #112 ??
  • #113 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #114 ??
  • #115 ??
  • #116 ??
  • #117 ??
  • #118 ??
  • #119 XChangeProperty
    from /usr/lib/libX11.so.6
  • #120 ??
  • #121 ??
  • #122 ??
  • #123 ??
  • #124 ??
  • #125 ??
  • #126 ??
  • #127 ??
  • #128 ??
  • #129 ??
  • #130 ??
  • #131 ??
  • #132 ??
  • #133 ??
  • #134 ??
  • #135 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #136 ??
  • #137 ??
  • #138 ??
  • #139 ??
  • #140 ??
  • #141 ??
  • #142 ??
  • #143 ??
  • #144 ??
  • #145 ??
  • #146 ??
  • #147 ??
  • #148 ??
  • #149 ??
  • #150 ??
  • #151 ??
  • #152 ??
  • #153 ??
  • #154 ??
  • #155 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #156 ??
  • #157 ??
  • #158 ??
  • #159 ??
  • #160 ??
  • #161 ??
  • #162 ??
  • #163 ??
  • #164 ??
  • #165 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #166 ??
    from /lib/tls/libc.so.6
  • #167 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #168 ??
  • #169 ??
  • #170 in6addr_any
    from /lib/tls/libc.so.6
  • #171 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #172 ??
  • #173 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #174 ??
    from /lib/tls/libc.so.6
  • #175 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #176 ??
  • #177 ??
  • #178 free
    from /lib/tls/libc.so.6
  • #0 show_menu_for_button
    at gtk.c line 2865
  • #1 do_pending
    at functions.c line 1141
  • #2 button_proc
    at gtk.c line 643
  • #3 check_vals
    at gtk.c line 1819
  • #4 kframe_key_press_cb
    at gtk.c line 1865
  • #5 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #6 ??
  • #7 ??
  • #8 ??
  • #9 ??
    from /usr/lib/libgobject-2.0.so.0
  • #10 ??
  • #11 ??
  • #12 ??
  • #13 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #14 ??
  • #15 ??
  • #16 ??
  • #17 ??
  • #18 ??
  • #19 ??
  • #20 ??
  • #21 g_value_reset
    from /usr/lib/libgobject-2.0.so.0
  • #22 ??
  • #23 ??
  • #24 gtk_marshal_VOID__UINT_STRING
    from /usr/lib/libgtk-x11-2.0.so.0
  • #25 ??
    from /usr/lib/libgobject-2.0.so.0
  • #26 ??
  • #27 ??
  • #28 ??
  • #29 g_signal_has_handler_pending
    from /usr/lib/libgobject-2.0.so.0
  • #30 ??
  • #31 ??
  • #32 ??
  • #33 ??
  • #34 ??
  • #35 ??
  • #36 ??
  • #37 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #38 ??
  • #39 ??
  • #40 ??
  • #41 ??
    from /usr/lib/libgobject-2.0.so.0
  • #42 ??
  • #43 ??
  • #44 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #45 g_thread_use_default_impl
    from /usr/lib/libglib-2.0.so.0
  • #46 ??
  • #47 g_hash_table_lookup
    from /usr/lib/libglib-2.0.so.0
  • #48 ??
  • #49 g_param_spec_override
    from /usr/lib/libgobject-2.0.so.0
  • #50 ??
  • #51 ??
  • #52 ??
    from /usr/lib/libgobject-2.0.so.0
  • #53 ??
  • #54 ??
  • #55 ??
  • #56 ??
  • #57 ??
  • #58 ??
  • #59 ??
  • #60 ??
  • #61 ??
  • #62 ??
  • #63 ??
  • #64 g_object_steal_data
    from /usr/lib/libgobject-2.0.so.0
  • #65 ??
  • #66 ??
  • #67 ??
  • #68 g_type_value_table_peek
    from /usr/lib/libgobject-2.0.so.0
  • #69 ??
  • #70 ??
  • #71 ??
  • #72 ??
  • #73 ??
  • #74 ??
  • #75 ??
    from /usr/lib/libgobject-2.0.so.0
  • #76 ??
  • #77 ??
  • #78 ??
  • #79 ??
  • #80 ??
  • #81 ??
  • #82 ??
  • #83 ??
  • #84 ??
  • #85 ??
  • #86 ??
  • #87 ??
    from /usr/lib/libgobject-2.0.so.0
  • #88 ??
  • #89 ??
  • #90 ??
  • #91 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #92 ??
  • #93 ??
  • #94 ??
  • #95 ??
  • #96 ??
  • #97 ??
  • #98 ??
  • #99 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #100 ??
  • #101 ??
  • #102 ??
  • #103 ??
  • #104 ??
  • #105 ??
  • #106 ??
  • #107 ??
  • #108 ??
  • #109 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #110 ??
  • #111 ??
  • #112 ??
  • #113 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #114 ??
  • #115 ??
  • #116 ??
  • #117 ??
  • #118 ??
  • #119 XChangeProperty
    from /usr/lib/libX11.so.6
  • #120 ??
  • #121 ??
  • #122 ??
  • #123 ??
  • #124 ??
  • #125 ??
  • #126 ??
  • #127 ??
  • #128 ??
  • #129 ??
  • #130 ??
  • #131 ??
  • #132 ??
  • #133 ??
  • #134 ??
  • #135 ??
    from /usr/lib/libgdk-x11-2.0.so.0
  • #136 ??
  • #137 ??
  • #138 ??
  • #139 ??
  • #140 ??
  • #141 ??
  • #142 ??
  • #143 ??
  • #144 ??
  • #145 ??
  • #146 ??
  • #147 ??
  • #148 ??
  • #149 ??
  • #150 ??
  • #151 ??
  • #152 ??
  • #153 ??
  • #154 ??
  • #155 g_object_unref
    from /usr/lib/libgobject-2.0.so.0
  • #156 ??
  • #157 ??
  • #158 ??
  • #159 ??
  • #160 ??
  • #161 ??
  • #162 ??
  • #163 ??
  • #164 ??
  • #165 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #166 ??
    from /lib/tls/libc.so.6
  • #167 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #168 ??
  • #169 ??
  • #170 in6addr_any
    from /lib/tls/libc.so.6
  • #171 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #172 ??
  • #173 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #174 ??
    from /lib/tls/libc.so.6
  • #175 __malloc_initialize_hook
    from /lib/tls/libc.so.6
  • #176 ??
  • #177 ??
  • #178 free
    from /lib/tls/libc.so.6
 
As you can see, now it's Segmentation fault. May this is not gcalctool, but gtk 
problem? But I don't know how to check... BTW. I have gtk+-2.6.7 installed. 
Comment 6 Rich Burridge 2005-05-26 13:51:57 UTC
Thanks for your followup. Reopening to investigate the new problem.
Comment 7 Rich Burridge 2005-05-26 15:20:50 UTC
Peter,

Could I ask you to do a couple things please. 

Could you take the 5.6.14 version and apply the patch in the attachment 
to this bug and see if you still get the crash.

If you do, could you print out the values of "n" and "n->type" please?

As you are getting:

(gcalctool:14987): GLib-GObject-CRITICAL **: g_object_get_data: assertion 
`G_IS_OBJECT (object)' failed 

and 178 levels of stack trace, it looks like there may be a memory corruption
occuring here.

Also, is it random keyboard characters you are entering or is there a
reproducable test case I can use here? If it's the former, perhaps you 
could add the following line just before the first if statement in the
kframe_key_press_cb() routine in gtk.c (about line 1836):

fprintf(stderr, "key press: event->keyval: %d event->state: %d\n",
event->keyval, event->state);

and recompile and rerun gcalctool and sent me the output that it generates.

Thanks.


Comment 8 Peter 2005-05-26 16:16:38 UTC
I've used your patch, and now I can not reproduce this bug. So it seems that 
this patch fixes not only mouse behaviour. 
 
I'm closing bug. BTW. Why gnome-2.10 uses 5.5.42 so may be it's good idea to 
backport this patch? 
 
In any way, thank you for your work. 
Comment 9 Rich Burridge 2005-05-26 17:22:24 UTC
> So it seems that this patch fixes not only mouse behaviour.

Good. Thanks for trying it out.
 
> may be it's good idea to backport this patch? 

Indeed. I'll do that now.
Comment 10 Rich Burridge 2005-05-26 17:25:12 UTC
Ack! This fix also depends upon the changes for bug #172704
which includes string changes, so I won't be able to backport
it after all. Roll on GNOME 2.12.