Closed Bug 55268 Opened 19 years ago Closed 19 years ago

Crash "segment violation" when using PR_FormatTime

Categories

(NSPR :: NSPR, defect, P2, critical)

x86
BeOS
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ykoehler, Assigned: larryh)

Details

Attachments

(1 file)

Included is a fix for this crash.  The BeOS crash because the tm_zone and the tm_gmtoff 
member exist under BeOS but weren't initialized properly.
Can't upload with Net+... so here's the patch

Index: prtime.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/prtime.c,v
retrieving revision 3.9
diff -u -r3.9 prtime.c
--- prtime.c    1999/04/21 21:39:44     3.9
+++ prtime.c    2000/10/05 02:52:29
@@ -1655,6 +1655,13 @@
         return 0;
     }
 #endif
+#ifdef XP_BEOS
+       if(mktime(&a) == -1)
+       {
+      a.tm_zone = 0;
+         a.tm_gmtoff = NULL;
+       }
+#endif

     return strftime(buf, buflen, fmt, &a);
 }
This make mozilla crash as soon as you browse therefore I've raised the priority
Severity: normal → critical
Priority: P3 → P2
Does this patch work?

Index: mozilla/nsprpub/pr/src/misc/prtime.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/prtime.c,v
retrieving revision 3.9
diff -u -r3.9 prtime.c
--- prtime.c	1999/04/21 21:39:44	3.9
+++ prtime.c	2000/10/05 03:17:49
@@ -1649,7 +1649,7 @@
  * values for these two fields.
  */
 
-#if defined(SUNOS4) || (__GLIBC__ >= 2)
+#if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS)
     if (mktime(&a) == -1) {
         PR_snprintf(buf, buflen, "can't get timezone");
         return 0;
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assigned the bug to larryh.
Assignee: wtc → larryh
Target Milestone: --- → 4.0.2
Ok tried the propose solution to simply add || defined(XP_BEOS) and it works also!
Do you want this fix in NSPRPUB_CLIENT_BRANCH?
Any other branches?
tip + the client branch.

Btw, when is the client.mk will start using the tip?
Status: NEW → ASSIGNED
Checking in Wan-Teh's version of patch to the tip of tree.

/cvsroot/mozilla/nsprpub/pr/src/misc/prtime.c,v  <--  prtime.c
new revision: 3.12; previous revision: 3.11
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
I checked in the patch on the NSPRPUB_CLIENT_BRANCH
and the NSPRPUB_RELEASE_4_0_BRANCH.
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.