After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779923 - g_mime_utils_header_decode_date returns negative number on error
g_mime_utils_header_decode_date returns negative number on error
Status: RESOLVED FIXED
Product: gmime
Classification: Other
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2017-03-12 01:35 UTC by David Bremner
Modified: 2017-03-12 12:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program; in principle should print 0 (278 bytes, text/x-csrc)
2017-03-12 01:35 UTC, David Bremner
Details

Description David Bremner 2017-03-12 01:35:17 UTC
Created attachment 347733 [details]
test program; in principle should print 0

The documentation claims that g_mime_utils_header_decode_date will return 0 on error, but this seems not always to be the case. In the attached sample program it returns a large negative number (on my machine -2209075200). Although it's not completely portable, on this machine a time_t is indeed a long int.  
I'm running Debian GNU/Linux on an amd64 machine, and the gmime version is 2.6.22-2
Comment 1 David Bremner 2017-03-12 01:50:47 UTC
by the way (* 70 365 24 60 60) = 2209075200
Comment 2 David Bremner 2017-03-12 01:55:47 UTC
(In reply to David Bremner from comment #1)
> by the way (* 70 365 24 60 60) = 2209075200

oops, I read too quickly,

It actually equals 

2207520000

Maybe it's just a coincidence, but the returned value is just over 70 years before the epoch.
Comment 3 Jeffrey Stedfast 2017-03-12 12:12:40 UTC
Fixed in the upcoming 3.0 (aka https://github.com/jstedfast/gmime master)