Skip to content
Snippets Groups Projects
Commit d51a04d1 authored by rswindell's avatar rswindell
Browse files

strftime() will throw an assertion in MSVC10 when passed an invalid struct tm

(e.g. zeroed-out).
parent bde2c65e
Branches
Tags
No related merge requests found
...@@ -2955,9 +2955,8 @@ js_strftime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -2955,9 +2955,8 @@ js_strftime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
rc=JS_SUSPENDREQUEST(cx); rc=JS_SUSPENDREQUEST(cx);
strcpy(str,"-Invalid time-"); strcpy(str,"-Invalid time-");
t=i; t=i;
if(localtime_r(&t,&tm)==NULL) if(localtime_r(&t,&tm)!=NULL)
memset(&tm,0,sizeof(tm)); strftime(str,sizeof(str),fmt,&tm);
strftime(str,sizeof(str),fmt,&tm);
JS_RESUMEREQUEST(cx, rc); JS_RESUMEREQUEST(cx, rc);
if((js_str=JS_NewStringCopyZ(cx, str))==NULL) if((js_str=JS_NewStringCopyZ(cx, str))==NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment