[glib: 1/2] gdate: Use a more recent year when fetching the month names. Fixes #1386



commit 0458f4728fd983151d9b88caae9f94ea7eeff8b3
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Tue May 29 15:27:41 2018 +0200

    gdate: Use a more recent year when fetching the month names. Fixes #1386
    
    g_date_strftime() on Windows uses the SYSTEMTIME structure which requires the
    year to be >=1601. Passing 1 results in a negative SYSTEMTIME.wYear
    which makes GetDateFormatW() fail and crashes due to missing error handling.
    
    Just use 1976 as that's already used a few lines down.

 glib/gdate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gdate.c b/glib/gdate.c
index 13a16aaeb..bf146d17e 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -1088,7 +1088,7 @@ g_date_prepare_to_parse (const gchar      *str,
         {
          gchar *casefold;
          
-          g_date_set_dmy (&d, 1, i, 1);
+          g_date_set_dmy (&d, 1, i, 1976);
          
           g_return_if_fail (g_date_valid (&d));
          


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]