Merge pull request #4293 from AndrewMeadows/thermonuclear

fix crash in AudioScope for bad memory access
This commit is contained in:
Clément Brisset 2015-02-18 06:03:03 -08:00
commit 3f117ce322
3 changed files with 11 additions and 8 deletions

View file

@ -230,7 +230,7 @@ int AudioScope::addSilenceToScope(QByteArray* byteArray, int frameOffset, int si
int samplesToBufferEnd = _samplesPerScope - frameOffset;
if (silentSamples > samplesToBufferEnd) {
memset(destination + frameOffset, 0, samplesToBufferEnd * sizeof(int16_t));
memset(destination, 0, silentSamples - samplesToBufferEnd * sizeof(int16_t));
memset(destination, 0, (silentSamples - samplesToBufferEnd) * sizeof(int16_t));
} else {
memset(destination + frameOffset, 0, silentSamples * sizeof(int16_t));
}

View file

@ -310,20 +310,23 @@ int LimitedNodeList::updateNodeWithDataFromPacket(const SharedNodePointer& match
matchingNode->setLastHeardMicrostamp(usecTimestampNow());
if (!matchingNode->getLinkedData() && linkedDataCreateCallback) {
NodeData* linkedData = matchingNode->getLinkedData();
if (!linkedData && linkedDataCreateCallback) {
linkedDataCreateCallback(matchingNode.data());
}
QMutexLocker linkedDataLocker(&matchingNode->getLinkedData()->getMutex());
return matchingNode->getLinkedData()->parseData(packet);
if (linkedData) {
QMutexLocker linkedDataLocker(&linkedData->getMutex());
return linkedData->parseData(packet);
}
return 0;
}
int LimitedNodeList::findNodeAndUpdateWithDataFromPacket(const QByteArray& packet) {
SharedNodePointer matchingNode = sendingNodeForPacket(packet);
if (matchingNode) {
updateNodeWithDataFromPacket(matchingNode, packet);
return updateNodeWithDataFromPacket(matchingNode, packet);
}
// we weren't able to match the sender address to the address we have for this node, unlock and don't parse

View file

@ -347,7 +347,7 @@ void NodeList::handleICEConnectionToDomainServer() {
qDebug() << "Sending ping packets to establish connectivity with domain-server with ID"
<< uuidStringWithoutCurlyBraces(_domainHandler.getICEDomainID());
// send the ping packet to the local and public sockets for this nodfe
// send the ping packet to the local and public sockets for this node
QByteArray localPingPacket = constructPingPacket(PingType::Local, false, _domainHandler.getICEClientID());
writeUnverifiedDatagram(localPingPacket, _domainHandler.getICEPeer().getLocalSocket());