GNOME Bugzilla – Bug 128710
gcalctool 4.3.28 segfaults at startup (just installed from the sources)
Last modified: 2004-12-22 21:47:04 UTC
Description of Problem: Steps to reproduce the problem: 1. Simply run gcalctool. Actual Results: Segfaults. Expected Results: Eh! How often does this happen? always Additional Information: Just installed gcalctool 4.3.28 form the sources on my SuSE 8.1 GNU/Linux system. Below gdb's BT: Program received signal SIGSEGV, Segmentation fault.
+ Trace 42386
Thread 1024 (LWP 3123)
Since str is non null in remove_tsep (traced), it seems that writing to dstp is not allowed. Does it come from a const char*? Patch below fixes it (for me): --- get.c.orig 2003-12-04 17:01:23.000000000 +0100 +++ get.c 2003-12-07 01:56:35.000000000 +0100 @@ -231,6 +231,7 @@ init_vars() /* Setup default values for various variables. */ { int acc, i, n, size; + char tmp[13]; v->accuracy = 9; /* Initial accuracy. */ v->show_zeroes = FALSE; /* Don't show trailing zeroes. */ @@ -253,16 +254,26 @@ read_str(&v->iconlabel, _("calculator")); /* Default icon label. */ - MPstr_to_num("0.621", DEC, v->MPcon_vals[0]); /* kms/hr <=> miles/hr. */ - MPstr_to_num("1.4142135623", DEC, v->MPcon_vals[1]); /* square root of 2 */ - MPstr_to_num("2.7182818284", DEC, v->MPcon_vals[2]); /* e */ - MPstr_to_num("3.1415926535", DEC, v->MPcon_vals[3]); /* pi */ - MPstr_to_num("0.3937007", DEC, v->MPcon_vals[4]); /* cms <=> inch. */ - MPstr_to_num("57.295779513", DEC, v->MPcon_vals[5]); /* degrees/radian. */ - MPstr_to_num("1048576.0", DEC, v->MPcon_vals[6]); /* 2 ^ 20. */ - MPstr_to_num("0.0353", DEC, v->MPcon_vals[7]); /* grams <=> ounce. */ - MPstr_to_num("0.948", DEC, v->MPcon_vals[8]); /* Kjoules <=> BTU's. */ - MPstr_to_num("0.0610", DEC, v->MPcon_vals[9]); /* cms3 <=> inches3. */ + strcpy(tmp, "0.621"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[0]); /* kms/hr <=> miles/hr. */ + strcpy(tmp, "1.4142135623"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[1]); /* square root of 2 */ + strcpy(tmp, "2.7182818284"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[2]); /* e */ + strcpy(tmp, "3.1415926535"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[3]); /* pi */ + strcpy(tmp, "0.3937007"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[4]); /* cms <=> inch. */ + strcpy(tmp, "57.295779513"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[5]); /* degrees/radian. */ + strcpy(tmp, "1048576.0"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[6]); /* 2 ^ 20. */ + strcpy(tmp, "0.0353"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[7]); /* grams <=> ounce. */ + strcpy(tmp, "0.948"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[8]); /* Kjoules <=> BTU's. */ + strcpy(tmp, "0.0610"); + MPstr_to_num((char*)&tmp, DEC, v->MPcon_vals[9]); /* cms3 <=> inches3. */ n = 0; for (i = 0; i < MAXREGS; i++) {
Moving over to gcalctool (it's got its own buzilla realm).
I've reported this bug there 'cause I've read somewhere that gcalctool was the new official calculator of GNOME2. FYI I've also reported the bug directly to the maintainer (Rich). Thanx!
Yup. <Blush>. Found and fixed. You should be able to find a v4.3.29 of gcalctool (with the fix) in the same location as v4.3.28: http://ftp.gnome.org/pub/GNOME/sources/gcalctool/4.3/ *** This bug has been marked as a duplicate of 128603 ***