diff options
| author | 2026-05-22 19:20:51 +0200 | |
|---|---|---|
| committer | 2026-05-22 19:20:51 +0200 | |
| commit | ba82092e43d4769dbc6f0557d58a243f93542486 (patch) | |
| tree | 4054d7d4b701207f6a7def2799295557c5fdf68d /src/time64.h | |
| parent | 9711459dbed7d60bb00c7d2c052623e8489c88e1 (diff) | |
| download | libplist-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.h | 7 |
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; | |||
| 11 | typedef Int64 Time64_T; | 11 | typedef Int64 Time64_T; |
| 12 | typedef Int64 Year; | 12 | typedef Int64 Year; |
| 13 | 13 | ||
| 14 | #ifndef TIME64_MIN | ||
| 15 | #define TIME64_MIN ((Time64_T)INT64_MIN) | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #ifndef TIME64_MAX | ||
| 19 | #define TIME64_MAX ((Time64_T)INT64_MAX) | ||
| 20 | #endif | ||
| 14 | 21 | ||
| 15 | /* A copy of the tm struct but with a 64 bit year */ | 22 | /* A copy of the tm struct but with a 64 bit year */ |
| 16 | struct TM64 { | 23 | struct TM64 { |
