cltsrv crashes on Windows because strftime in VC 2005 doesn't support the %T format

RESOLVED FIXED in 4.7

Status

defect
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

other
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Assignee

Description

12 years ago
I just built NSPR on Windows with Visual C++ 2005 Express Edition.
I don't remember if I installed VC 2005 SP1.  The Help menu's
"About Visual C++ 2005 Express Edition" command says:
  Microsoft Visual Studio 2005
  Version 8.0.50727.762 (SP.050727-7600)

When I run the cltsrv.exe test program, it crashes because
"Microsoft Visual Studio C Runtime Library has detected a fatal
error in cltsrv.exe", with this call stack:

 	msvcr80.dll!7813bd7f() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msvcr80.dll]	
 	msvcr80.dll!78138a79() 	
 	msvcr80.dll!78148b85() 	
 	msvcr80.dll!78148bd2() 	
>	nspr4.dll!PR_FormatTime(char * buf=0x0012fa70, int buflen=100, const char * fmt=0x00405550, const PRExplodedTime * tm=0x0012fae0)  Line 1722 + 0x16 bytes	C
 	cltsrv.exe!TimeOfDayMessage(const char * msg=0x004054fc, PRThread * me=0x003f36d0)  Line 233 + 0x18 bytes	C
 	cltsrv.exe!main(int argc=1, char * * argv=0x003f5cb0)  Line 1031 + 0x11 bytes	C
 	cltsrv.exe!__tmainCRTStartup()  Line 597 + 0x17 bytes	C
 	kernel32.dll!7c816fd7() 	

The last NSPR source code in the call stack is this line in PR_FormatTime:

    return strftime(buf, buflen, fmt, &a);

'fmt' is "%T".  MSDN documentation on strftime doesn't list %T as
a formatting code:
http://msdn2.microsoft.com/en-us/library/fe06s4ak(VS.71).aspx

So I changed the PR_FormatTime call in cltsrv.c to pass the equivalent
"%H:%M:%S" instead of "%T", and that fixed the crash.

PR_FormatTimeUSEnglish, which formats the time string itself and
doesn't use strftime, doesn't support the %T format code either.
Attachment #296549 - Flags: review?(julien.pierre.boogz)
Assignee

Updated

12 years ago
Status: NEW → ASSIGNED

Updated

12 years ago
Attachment #296549 - Flags: review?(julien.pierre.boogz) → review+
Assignee

Comment 1

12 years ago
I checked in the patch on the NSPR trunk for NSPR 4.7.

Checking in cltsrv.c;
/cvsroot/mozilla/nsprpub/pr/tests/cltsrv.c,v  <--  cltsrv.c
new revision: 3.14; previous revision: 3.13
done
Checking in provider.c;
/cvsroot/mozilla/nsprpub/pr/tests/provider.c,v  <--  provider.c
new revision: 3.14; previous revision: 3.13
done
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.7
You need to log in before you can comment on or make changes to this bug.