[poppler] glib/poppler-attachment.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 25 21:26:34 UTC 2019


 glib/poppler-attachment.cc |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 6f5327114c824791dda72dc415b047d445e46d9d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jan 25 16:10:08 2019 +0100

    glib: Fix cast from 'GTime *' (aka 'int *') to 'time_t *' (aka 'long *')
    
    Sounds rather scary since we're storing a bigger value than what really
    fits.
    
    Fixed by the suggestion of https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#GTime
    
    Changing the type of _PopplerAttachment ctime/mtime would change the
    structure size, thus break the BC, so leaving that for the future for
    now

diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
index ff09edcf..dd8864d1 100644
--- a/glib/poppler-attachment.cc
+++ b/glib/poppler-attachment.cc
@@ -111,9 +111,17 @@ _poppler_attachment_new (FileSpec *emb_file)
       attachment->size = embFile->size ();
 
       if (embFile->createDate ())
-        _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
+        {
+          time_t aux;
+          _poppler_convert_pdf_date_to_gtime (embFile->createDate (), &aux);
+          attachment->ctime = (GTime)aux; // FIXME This will overflow on dates from after 2038
+        }
       if (embFile->modDate ())
-        _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
+        {
+          time_t aux;
+          _poppler_convert_pdf_date_to_gtime (embFile->modDate (), &aux);
+          attachment->mtime = (GTime)aux; // FIXME This will overflow on dates from after 2038
+        }
 
       if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
         attachment->checksum = g_string_new_len (embFile->checksum ()->c_str (),


More information about the poppler mailing list