<table><tr><td style="">marten created this revision.<br />marten added a reviewer: KDE PIM.<br />Herald added a project: KDE PIM.<br />Herald added a subscriber: kde-pim.<br />marten requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28876">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>There is a maximum number of recipients set in Configure KMail - Composer - General - Maximum number of recipient entries. If this limit is exceeded then a message "We can not add more recipients. We have reached maximum recipients" is shown and no more are accepted. The problem is that, when the limit is hit and the message appears, MultiplyingLineView::addLine() returns a null pointer but MultiplyingLineView::slotReturnPressed() uses the pointer without a check, so crashing KMail.</p>
<p>To reproduce: Set the limit to an impracticably small number (e.g. 3).<br />
Start a new KMail composer and enter two recipients.</p>
<p>Start to type a third, the error message is shown but a popup list of completed addresses still appears. This is wrong, because we are entering the third address which is within the limit so far.</p>
<p>Click on one of the addresses, the error message is shown again. This is again wrong, because so far there are still only three addresses.</p>
<p>Press Return, the error message is shown yet again. This is now correct, because there are already 3 addresses and no more can be added.<br />
Dismiss the error box, KMail crashes with a null pointer dereference in MultiplyingLineView::activateLine().</p>
<p>There is obviously a deeper problem here because the error box is shown when it is not appropriate (when the 3rd address is being entered) which needs investigation, but this change at least fixes the crash.</p>
<p>The problem can also be triggered by doing a reply-all to a message with too many recipients. This is more serious because if KMail crashes as a result, on the next startup it will try to reload the autosaved message into the composer which will trigger the same problem. This makes KMail unusable unless that autosave file is removed manually.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Built libkdepim with this change, observed that there is no crash when trying to enter too many recipient addresses as above.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R89 PIM: Libraries</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28876">https://phabricator.kde.org/D28876</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/libkdepim/multiplyingline/multiplyinglineview_p.cpp</div></div></div><br /><div><strong>To: </strong>marten, KDE PIM<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>