Skip to content

Commit 1572aa8

Browse files
author
Fabrice Bellard
committed
avoid win32 crash in getTimezoneOffset() if time is < 1970 (#238)
1 parent 7c487f1 commit 1572aa8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

quickjs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44429,9 +44429,13 @@ static int getTimezoneOffset(int64_t time)
4442944429
time_t gm_ti, loc_ti;
4443044430

4443144431
tm = gmtime(&ti);
44432+
if (!tm)
44433+
return 0;
4443244434
gm_ti = mktime(tm);
4443344435

4443444436
tm = localtime(&ti);
44437+
if (!tm)
44438+
return 0;
4443544439
loc_ti = mktime(tm);
4443644440

4443744441
res = (gm_ti - loc_ti) / 60;

0 commit comments

Comments
 (0)