From a3215e2a6577df39d944578af671f9dae2770336 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 6 Nov 2026 10:32:42 +0100 Subject: plist: treat NaN date values as 0 in plist_get_date_val Converting NaN to int32_t is undefined behavior, and NaN can come from a parsed date node. --- src/plist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plist.c b/src/plist.c index 85c2338..ea3a247 100644 --- a/src/plist.c +++ b/src/plist.c @@ -1891,6 +1891,8 @@ void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) assert(length == sizeof(double)); /* Inverse of plist_set_date_val (val = sec + usec / 1000000): * whole seconds rounded down, the fraction rounded to microseconds. */ + if (isnan(val)) + val = 0; double whole = floor(val); double frac_usec = round((val - whole) * 1000000); if (frac_usec >= 1000000) { -- cgit v1.1-32-gdbae