文章预览
与https://bugs.chromium.org/p/project-zero/issues/detail?id=2505相关;在修复时,查看 Connection::onReceivedData ,会发现另一个可能使 buffer 失效的情况。 void Connection::onReceivedData(NativeByteBuffer *buffer) { AES_ctr128_encrypt(buffer->bytes(), buffer->bytes(), buffer-> limit (), , decryptIv, decryptCount, ); // snip... NativeByteBuffer *reuseLater = nullptr; while (buffer->hasRemaining()) { // snip... uint32_t old = buffer-> limit (); buffer-> limit (buffer->position() + currentPacketLength); ConnectionsManager::getInstance(currentDatacenter->instanceNum).onConnectionDataReceived(this, buffer, currentPacketLength); buffer->position(buffer-> limit ()); // < -- 在这里使用 buffer-> limit (old); // snip... 我们可以看到调用 ConnectionsManager::onConnectionDataReceived ,在这个调用之后,buffer等应该仍然是有效的。如果
………………………………