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 128710 - gcalctool 4.3.28 segfaults at startup (just installed from the sources)
gcalctool 4.3.28 segfaults at startup (just installed from the sources)
Status: RESOLVED DUPLICATE of bug 128603
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2003-12-07 00:58 UTC by wwp
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.0



Description wwp 2003-12-07 00:58:37 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.

Thread 1024 (LWP 3123)

  • #0 remove_tsep
    at display.c line 87
  • #1 MPstr_to_num
    at display.c line 397
  • #2 init_vars
    at get.c line 256
  • #3 do_calctool
    at calctool.c line 1024
  • #4 main
    at gtk.c line 272


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++) {
Comment 1 John Fleck 2003-12-07 01:24:34 UTC
Moving over to gcalctool (it's got its own buzilla realm).
Comment 2 wwp 2003-12-07 01:31:45 UTC
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!
Comment 3 Rich Burridge 2003-12-07 01:43:15 UTC
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 ***