Bug 166721 - parseRFCDate - wrong bad date handling
Summary: parseRFCDate - wrong bad date handling
Status: RESOLVED FIXED
Alias: None
Product: kdepimlibs
Classification: Applications
Component: syndication (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 166495 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-16 12:52 UTC by Michal Hlavinka
Modified: 2008-10-15 21:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch to fix this problem (836 bytes, patch)
2008-07-16 12:53 UTC, Michal Hlavinka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Hlavinka 2008-07-16 12:52:17 UTC
Version:           svn833178 (using Devel)
Installed from:    Compiled sources
Compiler:          gcc 4.3.1 
OS:                Linux

if string contains date in wrong format, parseRFCDate (or parseISODate) returns 2^32-1

result: some apps (akregator) don't know about error, because returned value uint32_t(-1) is not expected time_t(-1)=uint64_t(-1). This leads to wrong dates being displayed

Problem is located between Qt 4 and KDateTime.

KDateTime::toTime_t() returns time_t (64bit at least on my computer)
but
QDateTime::toTime_t() returns uint (32bit)

QDateTime's -1 is converted to 4294967295, but error is tested for -1

solution: QDateTime's return type is small, should be time_t, not uint

fix: Don't test for -1 but do QDateTime/KDateTime::isValid() tests
Comment 1 Michal Hlavinka 2008-07-16 12:53:59 UTC
Created attachment 26171 [details]
patch to fix this problem
Comment 2 Allen Winter 2008-07-16 15:19:21 UTC
SVN commit 833224 by winterz:

Fix wrong bad date handling
Thanks for the patch Michal.
BUG: 166721


 M  +6 -4      tools.cpp  
 M  +9 -5      tools.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=833224
Comment 3 Frank Osterfeld 2008-10-15 21:41:23 UTC
*** Bug 166495 has been marked as a duplicate of this bug. ***