summaryrefslogtreecommitdiffstats
path: root/src/time64.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-05-22 19:20:51 +0200
committerGravatar Nikias Bassen2026-05-22 19:20:51 +0200
commitba82092e43d4769dbc6f0557d58a243f93542486 (patch)
tree4054d7d4b701207f6a7def2799295557c5fdf68d /src/time64.h
parent9711459dbed7d60bb00c7d2c052623e8489c88e1 (diff)
downloadlibplist-ba82092e43d4769dbc6f0557d58a243f93542486.tar.gz
libplist-ba82092e43d4769dbc6f0557d58a243f93542486.tar.bz2
common: validate PLIST_DATE values before Time64_T conversion
Avoid undefined behavior when serializing malformed PLIST_DATE values containing NaN, infinity, or values outside the Time64_T range. Add a shared helper for checked date conversion and use it across writer paths.
Diffstat (limited to 'src/time64.h')
-rw-r--r--src/time64.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/time64.h b/src/time64.h
index 28968c0..2c20ffe 100644
--- a/src/time64.h
+++ b/src/time64.h
@@ -11,6 +11,13 @@ typedef long long Int64;
typedef Int64 Time64_T;
typedef Int64 Year;
+#ifndef TIME64_MIN
+#define TIME64_MIN ((Time64_T)INT64_MIN)
+#endif
+
+#ifndef TIME64_MAX
+#define TIME64_MAX ((Time64_T)INT64_MAX)
+#endif
/* A copy of the tm struct but with a 64 bit year */
struct TM64 {