mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 17:08:53 +02:00
gdatetime: Fix error handling in g_date_time_new_ordinal()
It was possible to pass in (for example) an invalid hour to g_date_time_new_ordinal(), which would be passed on to g_date_time_new(), which would (correctly) return `NULL` — but then g_date_time_new_ordinal() would try to dereference that. Includes some test cases. oss-fuzz#16103 oss-fuzz#17183 Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
@@ -1220,6 +1220,8 @@ g_date_time_new_ordinal (GTimeZone *tz, gint year, gint ordinal_day, gint hour,
|
||||
return NULL;
|
||||
|
||||
dt = g_date_time_new (tz, year, 1, 1, hour, minute, seconds);
|
||||
if (dt == NULL)
|
||||
return NULL;
|
||||
dt->days += ordinal_day - 1;
|
||||
|
||||
return dt;
|
||||
|
Reference in New Issue
Block a user