mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
Merge pull request #4293 from AndrewMeadows/thermonuclear
fix crash in AudioScope for bad memory access
This commit is contained in:
commit
3f117ce322
3 changed files with 11 additions and 8 deletions
|
@ -230,7 +230,7 @@ int AudioScope::addSilenceToScope(QByteArray* byteArray, int frameOffset, int si
|
||||||
int samplesToBufferEnd = _samplesPerScope - frameOffset;
|
int samplesToBufferEnd = _samplesPerScope - frameOffset;
|
||||||
if (silentSamples > samplesToBufferEnd) {
|
if (silentSamples > samplesToBufferEnd) {
|
||||||
memset(destination + frameOffset, 0, samplesToBufferEnd * sizeof(int16_t));
|
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 {
|
} else {
|
||||||
memset(destination + frameOffset, 0, silentSamples * sizeof(int16_t));
|
memset(destination + frameOffset, 0, silentSamples * sizeof(int16_t));
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,20 +310,23 @@ int LimitedNodeList::updateNodeWithDataFromPacket(const SharedNodePointer& match
|
||||||
|
|
||||||
matchingNode->setLastHeardMicrostamp(usecTimestampNow());
|
matchingNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||||
|
|
||||||
if (!matchingNode->getLinkedData() && linkedDataCreateCallback) {
|
NodeData* linkedData = matchingNode->getLinkedData();
|
||||||
|
if (!linkedData && linkedDataCreateCallback) {
|
||||||
linkedDataCreateCallback(matchingNode.data());
|
linkedDataCreateCallback(matchingNode.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
QMutexLocker linkedDataLocker(&matchingNode->getLinkedData()->getMutex());
|
if (linkedData) {
|
||||||
|
QMutexLocker linkedDataLocker(&linkedData->getMutex());
|
||||||
return matchingNode->getLinkedData()->parseData(packet);
|
return linkedData->parseData(packet);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LimitedNodeList::findNodeAndUpdateWithDataFromPacket(const QByteArray& packet) {
|
int LimitedNodeList::findNodeAndUpdateWithDataFromPacket(const QByteArray& packet) {
|
||||||
SharedNodePointer matchingNode = sendingNodeForPacket(packet);
|
SharedNodePointer matchingNode = sendingNodeForPacket(packet);
|
||||||
|
|
||||||
if (matchingNode) {
|
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
|
// we weren't able to match the sender address to the address we have for this node, unlock and don't parse
|
||||||
|
|
|
@ -347,7 +347,7 @@ void NodeList::handleICEConnectionToDomainServer() {
|
||||||
qDebug() << "Sending ping packets to establish connectivity with domain-server with ID"
|
qDebug() << "Sending ping packets to establish connectivity with domain-server with ID"
|
||||||
<< uuidStringWithoutCurlyBraces(_domainHandler.getICEDomainID());
|
<< 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());
|
QByteArray localPingPacket = constructPingPacket(PingType::Local, false, _domainHandler.getICEClientID());
|
||||||
writeUnverifiedDatagram(localPingPacket, _domainHandler.getICEPeer().getLocalSocket());
|
writeUnverifiedDatagram(localPingPacket, _domainHandler.getICEPeer().getLocalSocket());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue