ObjectSnap::ObjectSnap() {
if (!hasBuiltinCompareObjectHandles() && !needsWow64HandleLookup()) {
m_table = queryNtHandles();
m_hasTable = true;
}
}
uint64_t ObjectSnap::object(RemoteHandle h) {
if (needsWow64HandleLookup()) {
return wow64LookupKernelObject(h.worker().pid(), h.value());
}
if (!m_hasTable) {
m_table = queryNtHandles();
}
return reinterpret_cast<uint64_t>(ntHandlePointer(
m_table, h.worker().pid(), h.value()));
}
This code looks suspicious to me. I think ObjectSnap::object could in principle initialize m_table multiple times. I think it should also set m_hasTable to true, and then the constructor can be removed.
ObjectSnap::object is public, so it could be invoked from a test case without going through eq. I thought that actually mattered, but now I don't see any call sites, so maybe it doesn't.
This code looks suspicious to me. I think
ObjectSnap::objectcould in principle initializem_tablemultiple times. I think it should also setm_hasTabletotrue, and then the constructor can be removed.ObjectSnap::objectis public, so it could be invoked from a test case without going througheq. I thought that actually mattered, but now I don't see any call sites, so maybe it doesn't.