commit 6dc8479e962374ad4af02abbe19415736c1d85a0
parent a431a9498a3d4d00fedfce72b5f0f70cb8a13b4b
Author: Kai Engert <kaie@kuix.de>
Date: Thu, 13 Nov 2025 15:43:47 +0000
Bug 1999107 - Uplift NSPR 4.38.2. r=jcristau UPGRADE_NSPR_RELEASE
Differential Revision: https://phabricator.services.mozilla.com/D272061
Diffstat:
8 files changed, 62 insertions(+), 15 deletions(-)
diff --git a/nsprpub/TAG-INFO b/nsprpub/TAG-INFO
@@ -1 +1 @@
-NSPR_4_38_RTM
-\ No newline at end of file
+NSPR_4_38_2_RTM
+\ No newline at end of file
diff --git a/nsprpub/config/prdepend.h b/nsprpub/config/prdepend.h
@@ -10,3 +10,4 @@
*/
#error "Do not include this header file."
+
diff --git a/nsprpub/configure b/nsprpub/configure
@@ -3004,7 +3004,7 @@ test -n "$target_alias" &&
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=38
-MOD_PATCH_VERSION=0
+MOD_PATCH_VERSION=2
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
diff --git a/nsprpub/configure.in b/nsprpub/configure.in
@@ -16,7 +16,7 @@ dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=38
-MOD_PATCH_VERSION=0
+MOD_PATCH_VERSION=2
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h
@@ -30,10 +30,10 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
-#define PR_VERSION "4.38"
+#define PR_VERSION "4.38.2"
#define PR_VMAJOR 4
#define PR_VMINOR 38
-#define PR_VPATCH 0
+#define PR_VPATCH 2
#define PR_BETA PR_FALSE
/*
diff --git a/nsprpub/pr/src/misc/prtime.c b/nsprpub/pr/src/misc/prtime.c
@@ -1277,7 +1277,7 @@ PR_ParseTimeStringToExplodedTime(const char* string, PRBool default_to_gmt,
{
break;
}
- if ((end - rest) == 2)
+ else if ((end - rest) == 2)
tmp_sec = ((rest[0] - '0') * 10 + (rest[1] - '0'));
else {
tmp_sec = (rest[0] - '0');
diff --git a/nsprpub/pr/tests/parsetm.c b/nsprpub/pr/tests/parsetm.c
@@ -3,12 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/*
- * This test program should eventually become a full-blown test for
- * PR_ParseTimeString. Right now it just verifies that PR_ParseTimeString
- * doesn't crash on an out-of-range time string (bug 480740).
- */
-
#include "prtime.h"
#include <time.h>
@@ -59,7 +53,52 @@ static void PrintExplodedTime(const PRExplodedTime* et) {
}
}
+static PRStatus KnownAnswerTest(void) {
+ static const struct {
+ const char* string;
+ PRBool default_to_gmt;
+ PRTime expected;
+ } tests[] = {
+ {"Mon, 15 Oct 2007 19:45:00 GMT", PR_FALSE, PR_INT64(1192477500000000)},
+ {"15 Oct 07 19:45 GMT", PR_FALSE, PR_INT64(1192477500000000)},
+ {"Mon Oct 15 12:45 PDT 2007", PR_FALSE, PR_INT64(1192477500000000)},
+ {"16 Oct 2007 4:45-JST (Tuesday)", PR_FALSE, PR_INT64(1192477500000000)},
+ // Not normalized.
+ {"Mon Oct 15 12:44:60 PDT 2007", PR_FALSE, PR_INT64(1192477500000000)},
+ // Not normalized.
+ {"Sun Oct 14 36:45 PDT 2007", PR_FALSE, PR_INT64(1192477500000000)},
+ {"Mon, 15 Oct 2007 19:45:23 GMT", PR_FALSE, PR_INT64(1192477523000000)},
+ };
+
+ PRBool failed = PR_FALSE;
+
+ for (int i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ PRTime result = 0;
+ if (PR_ParseTimeString(tests[i].string, tests[i].default_to_gmt, &result) !=
+ PR_SUCCESS) {
+ printf("PR_ParseTimeString(\"%s\", %s, &result) failed\n",
+ tests[i].string, tests[i].default_to_gmt ? "PR_TRUE" : "PR_FALSE");
+ failed = PR_TRUE;
+ continue;
+ }
+ if (result != tests[i].expected) {
+ printf(
+ "PR_ParseTimeString(\"%s\", %s, &result) returns %lld, expected "
+ "%lld\n",
+ tests[i].string, tests[i].default_to_gmt ? "PR_TRUE" : "PR_FALSE",
+ (long long)result, (long long)tests[i].expected);
+ failed = PR_TRUE;
+ }
+ }
+
+ return failed ? PR_FAILURE : PR_SUCCESS;
+}
+
int main(int argc, char** argv) {
+ /*
+ * 1. Verify that PR_ParseTimeString doesn't crash on an out-of-range time
+ * string (bug 480740).
+ */
PRTime ct;
PRExplodedTime et;
PRStatus rv;
@@ -84,5 +123,12 @@ int main(int argc, char** argv) {
PrintExplodedTime(&et);
printf("\n");
+ /* 2. Run a full-blown test for PR_ParseTimeString. */
+ if (KnownAnswerTest() != PR_SUCCESS) {
+ printf("FAIL\n");
+ return 1;
+ }
+
+ printf("PASS\n");
return 0;
}
diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c
@@ -38,7 +38,7 @@ static char* compatible_version[] = {
"4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22",
"4.23", "4.24", "4.25", "4,26", "4.27", "4.28", "4.29",
"4.30", "4.31", "4.32", "4.33", "4.34", "4.35", "4.36",
- "4.37",
+ "4.37", "4.38", "4.38.1",
PR_VERSION};
/*
@@ -50,7 +50,7 @@ static char* compatible_version[] = {
*/
static char* incompatible_version[] = {
"2.1 19980529", "3.0", "3.0.1", "3.1", "3.1.1",
- "3.1.2", "3.1.3", "3.5", "3.5.1", "4.38.1",
+ "3.1.2", "3.1.3", "3.5", "3.5.1", "4.38.3",
"4.39", "4.39.1", "10.0", "11.1", "12.14.20"};
int main(int argc, char** argv) {