shithub: libmujs

Download patch

ref: 872cef584db8fdb766f03e7cc5df8e6ea5c7ebdc
parent: 14b9aab19395c6aec0cb53205c5d6d6da7d057f5
author: Tor Andersson <tor.andersson@gmail.com>
date: Wed Mar 29 11:55:00 EDT 2017

Bug 697700: Fix typo and add more range checks in parseDateTime.

--- a/jsdate.c
+++ b/jsdate.c
@@ -303,9 +303,12 @@
 
 	if (*s) return NAN;
 
-	if (m > 11) return NAN;
+	if (m < 1 || m > 12) return NAN;
 	if (d < 1 || d > 31) return NAN;
-	if (H > 24 || M > 59 || S > 59) return NAN;
+	if (H < 0 || H > 24) return NAN;
+	if (M < 0 || M > 59) return NAN;
+	if (S < 0 || S > 59) return NAN;
+	if (ms < 0 || ms > 999) return NAN;
 	if (H == 24 && (M != 0 || S != 0 || ms != 0)) return NAN;
 
 	/* TODO: DaylightSavingTA on local times */