mirror of https://github.com/procxx/kepka.git
Fix crash in selecting unsent messages.
Also add some more checks in file downloads and serialization.
This commit is contained in:
parent
6994201d50
commit
ad6ddcb507
|
@ -1066,9 +1066,11 @@ void HistoryInner::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton bu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_mouseAction == MouseAction::PrepareSelect && !_pressWasInactive && !_selected.empty() && _selected.cbegin()->second == FullSelection) {
|
if (_mouseAction == MouseAction::PrepareSelect && !_pressWasInactive && !_selected.empty() && _selected.cbegin()->second == FullSelection) {
|
||||||
SelectedItems::iterator i = _selected.find(_mouseActionItem);
|
auto i = _selected.find(_mouseActionItem);
|
||||||
if (i == _selected.cend() && !_mouseActionItem->serviceMsg() && _mouseActionItem->id > 0) {
|
if (i == _selected.cend()) {
|
||||||
if (_selected.size() < MaxSelectedItems) {
|
if (!_mouseActionItem->serviceMsg()
|
||||||
|
&& IsServerMsgId(_mouseActionItem->id)
|
||||||
|
&& _selected.size() < MaxSelectedItems) {
|
||||||
if (!_selected.empty() && _selected.cbegin()->second != FullSelection) {
|
if (!_selected.empty() && _selected.cbegin()->second != FullSelection) {
|
||||||
_selected.clear();
|
_selected.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ void DcOptions::constructFromSerialized(const QByteArray &serialized) {
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/1076714/max-length-for-client-ip-address
|
// https://stackoverflow.com/questions/1076714/max-length-for-client-ip-address
|
||||||
constexpr auto kMaxIpSize = 45;
|
constexpr auto kMaxIpSize = 45;
|
||||||
if (ipSize > kMaxIpSize) {
|
if (ipSize <= 0 || ipSize > kMaxIpSize) {
|
||||||
LOG(("MTP Error: Bad data inside DcOptions::constructFromSerialized()"));
|
LOG(("MTP Error: Bad data inside DcOptions::constructFromSerialized()"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,6 +662,8 @@ void mtpFileLoader::getCdnFileHashesDone(const MTPVector<MTPCdnFileHash> &result
|
||||||
}
|
}
|
||||||
|
|
||||||
void mtpFileLoader::placeSentRequest(mtpRequestId requestId, const RequestData &requestData) {
|
void mtpFileLoader::placeSentRequest(mtpRequestId requestId, const RequestData &requestData) {
|
||||||
|
Expects(!_finished);
|
||||||
|
|
||||||
_downloader->requestedAmountIncrement(requestData.dcId, requestData.dcIndex, partSize());
|
_downloader->requestedAmountIncrement(requestData.dcId, requestData.dcIndex, partSize());
|
||||||
++_queue->queriesCount;
|
++_queue->queriesCount;
|
||||||
_sentRequests.emplace(requestId, requestData);
|
_sentRequests.emplace(requestId, requestData);
|
||||||
|
|
Loading…
Reference in New Issue