<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:11pt;font-family:Bitstream Vera Sans Mono">
<p>Hi,</p>
<p></p>
<p>I stumbled over three (IMHO severe) bugs in kdecore/krfcdate, affecting kdelibs from trunk and 3.5 branch:</p>
<p></p>
<p>1) (trunk/3.5 branch) </p>
<p></p>
<p>When passing an invalid string date like e.g. "Thu, 01 Jan 2004 19:48:21 GMT" (valid RFC date string, but not ISO) to</p>
<p></p>
<p>time_t KRFCDate::parseDateISO8601(const QString&)</p>
<p></p>
<p>my test app exits due to a failed assert:</p>
<p></p>
<p>ASSERT failure in QList<T>::operator[]: "index out of range", </p>
<p>file /opt2/kde4/include/QtCore/qlist.h, line 369</p>
<p></p>
<p>This is because string lists splitted from the input string are accessed without checking the list size beforehand.</p>
<p></p>
<p>2) (trunk only)</p>
<p>RFCDate::parseDate(QString()) returns 1 (used for both epoch and epoch+1) instead of 0 (invalid).</p>
<p>3) (3.5 branch only)</p>
<p></p>
<p>RFCDate::parseDate(QString()) crashes.</p>
<p></p>
<p></p>
<p>The attached patch fixes these bugs, returning 0 when passing an empty string to either of the two methods, and avoiding the assert fails by checking the size of the string lists.</p>
<p></p>
<p><span style="font-family:Andale Mono">Also, the test cases in both trunk and 3.5 branch contain only valid dates, but no invalid ones. I added some invalid cases including the case mentioned above.</span></p>
<p></p>
<p>I can't find a maintainer of the class, so I send the patch to the list.</p>
<p>Tell me whether it's okay to commit.</p>
<p></p>
<p>Regards,</p>
<p></p>
<p>Frank</p>
<p></p>
</body></html>