summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-01-25 16:10:08 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2019-01-25 21:19:08 +0000
commit6f5327114c824791dda72dc415b047d445e46d9d (patch)
tree21e76ffdd93a84d02d1cb9ecda43a6ca0c9cb2bf /glib
parentf2493d53a70e10ea69bd147c48be7c8544979436 (diff)
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
Diffstat (limited to 'glib')
-rw-r--r--glib/poppler-attachment.cc12
1 files changed, 10 insertions, 2 deletions
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 (),