[Bug 166721] New: parseRFCDate - wrong bad date handling

Michal Hlavinka masp01 at centrum.cz
Wed Jul 16 12:52:18 CEST 2008

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
           Summary: parseRFCDate - wrong bad date handling
           Product: kdepimlibs
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: syndication
        AssignedTo: kdepim-bugs kde org
        ReportedBy: masp01 centrum cz

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)
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

More information about the Kdepim-bugs mailing list