Bug 268837 - kcalc crashes when calculating the cube root of a very large number
Summary: kcalc crashes when calculating the cube root of a very large number
Status: RESOLVED FIXED
Alias: None
Product: kcalc
Classification: Applications
Component: general (show other bugs)
Version: 2.7
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Evan Teran
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-18 18:56 UTC by Lester Petrie
Modified: 2011-03-21 17:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lester Petrie 2011-03-18 18:56:31 UTC
Application: kcalc (2.7)
KDE Platform Version: 4.5.5 (KDE 4.5.5)
Qt Version: 4.6.3
Operating System: Linux 2.6.34.8-68.fc13.x86_64 x86_64
Distribution: "Fedora release 13 (Goddard)"

-- Information about the crash:
- What I was doing when the application crashed:
I generated 6!, then did the factorial of that (720!).  I then tried to take the cube root of the resulting number, and kcalc crashes.

The crash can be reproduced every time.

-- Backtrace:
Application: KCalc (kcalc), signal: Aborted
82	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
[KCrash Handler]
#6  0x00000037e88328f5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00000037e88340d5 in abort () at abort.c:92
#8  0x00000037fb409eb3 in __gmp_invalid_operation () at ../invalid.c:71
#9  0x00000037fb40bc46 in __gmpf_set_d (r=0x29bb758, d=0) at ../../mpf/set_d.c:35
#10 0x0000003958a1ad49 in _knuminteger::cbrt (this=0x269cc60) at /usr/src/debug/kdeutils-4.5.5/kcalc/knumber/knumber_priv.cpp:409
#11 0x0000003958a160a4 in KNumber::cbrt (this=0x7fffeb0d5f60) at /usr/src/debug/kdeutils-4.5.5/kcalc/knumber/knumber.cpp:456
#12 0x0000003958a39d89 in CalcEngine::CubeRoot (this=0x26d9258, input=<value optimized out>) at /usr/src/debug/kdeutils-4.5.5/kcalc/kcalc_core.cpp:595
#13 0x0000003958a1d395 in KCalculator::slotCubeclicked (this=0x26d8eb0) at /usr/src/debug/kdeutils-4.5.5/kcalc/kcalc.cpp:1134
#14 0x0000003958a2727d in KCalculator::qt_metacall (this=0x26d8eb0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffeb0d60c0)
    at /usr/src/debug/kdeutils-4.5.5/x86_64-redhat-linux-gnu/kcalc/kcalc.moc:217
#15 0x0000003955566716 in QMetaObject::activate (sender=0x271bcb0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fffeb0d60c0) at kernel/qobject.cpp:3295
#16 0x00000039573e1902 in QAbstractButton::clicked (this=<value optimized out>, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:206
#17 0x000000395712ffbb in QAbstractButtonPrivate::emitClicked (this=0x2737940) at widgets/qabstractbutton.cpp:546
#18 0x000000395713133b in QAbstractButtonPrivate::click (this=0x2737940) at widgets/qabstractbutton.cpp:539
#19 0x00000039571315ac in QAbstractButton::mouseReleaseEvent (this=0x271bcb0, e=0x7fffeb0d6a10) at widgets/qabstractbutton.cpp:1121
#20 0x0000003956df643a in QWidget::event (this=0x271bcb0, event=0x7fffeb0d6a10) at kernel/qwidget.cpp:8044
#21 0x0000003956dab39c in QApplicationPrivate::notify_helper (this=0x25f5ee0, receiver=0x271bcb0, e=0x7fffeb0d6a10) at kernel/qapplication.cpp:4306
#22 0x0000003956db1e2d in QApplication::notify (this=<value optimized out>, receiver=0x271bcb0, e=0x7fffeb0d6a10) at kernel/qapplication.cpp:3871
#23 0x000000395801d186 in KApplication::notify (this=0x7fffeb0d7710, receiver=0x271bcb0, event=0x7fffeb0d6a10) at /usr/src/debug/kdelibs-4.5.5/kdeui/kernel/kapplication.cpp:310
#24 0x0000003955553adc in QCoreApplication::notifyInternal (this=0x7fffeb0d7710, receiver=0x271bcb0, event=0x7fffeb0d6a10) at kernel/qcoreapplication.cpp:726
#25 0x0000003956db101e in sendEvent (receiver=0x271bcb0, event=0x7fffeb0d6a10, alienWidget=0x271bcb0, nativeWidget=0x26d8eb0, buttonDown=0x3957829828, lastMouseReceiver=..., spontaneous=true)
    at ../../src/corelib/kernel/qcoreapplication.h:215
#26 QApplicationPrivate::sendMouseEvent (receiver=0x271bcb0, event=0x7fffeb0d6a10, alienWidget=0x271bcb0, nativeWidget=0x26d8eb0, buttonDown=0x3957829828, lastMouseReceiver=..., spontaneous=true)
    at kernel/qapplication.cpp:2971
#27 0x0000003956e230d5 in QETWidget::translateMouseEvent (this=0x26d8eb0, event=<value optimized out>) at kernel/qapplication_x11.cpp:4380
#28 0x0000003956e21ae0 in QApplication::x11ProcessEvent (this=0x7fffeb0d7710, event=0x7fffeb0d7330) at kernel/qapplication_x11.cpp:3513
#29 0x0000003956e4a9f6 in x11EventSourceDispatch (s=0x25f9c60, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:148
#30 0x00000037ea43bd02 in g_main_dispatch (context=0x25f8cb0) at gmain.c:1960
#31 IA__g_main_context_dispatch (context=0x25f8cb0) at gmain.c:2513
#32 0x00000037ea43fae8 in g_main_context_iterate (context=0x25f8cb0, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2591
#33 0x00000037ea43fc9c in IA__g_main_context_iteration (context=0x25f8cb0, may_block=1) at gmain.c:2654
#34 0x0000003955579503 in QEventDispatcherGlib::processEvents (this=0x25dcf40, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#35 0x0000003956e4a73e in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:207
#36 0x0000003955552522 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#37 0x00000039555527ec in QEventLoop::exec (this=0x7fffeb0d7660, flags=...) at kernel/qeventloop.cpp:201
#38 0x0000003955555ebb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1003
#39 0x0000003958a28402 in kdemain (argc=1, argv=0x7fffeb0d7b88) at /usr/src/debug/kdeutils-4.5.5/kcalc/kcalc.cpp:1938
#40 0x00000037e881ec5d in __libc_start_main (main=0x4007b0 <main(int, char**)>, argc=1, ubp_av=0x7fffeb0d7b88, init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffeb0d7b78) at libc-start.c:226
#41 0x00000000004006e9 in _start ()

Reported using DrKonqi
Comment 1 Evan Teran 2011-03-18 19:42:19 UTC
I've added proper error checking in the SVN. Unfortunately, you still can't calculate the cube root of !720, but at least it won't crash. I'm going to be looking into using a library for arbitrary precision algebraic functions. In addition I'm going to look into a generic "GMP aborted" handler.
Comment 2 Raphael Kubo da Costa 2011-03-21 03:12:14 UTC
Shouldn't this be backported to the 4.6 branch?
Comment 3 Evan Teran 2011-03-21 16:54:10 UTC
patch applied to the 4.6 branch :-).