Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SOS/Strike/strike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ DECLARE_API(DumpMT)

table.WriteRow("Entry", "MethodDesc", "JIT", "Slot", "Name");

ToRelease<ISOSMethodEnum> pMethodEnumerator;
ISOSMethodEnum *pMethodEnumerator;
if (SUCCEEDED(g_sos15->GetMethodTableSlotEnumerator(dwStartAddr, &pMethodEnumerator)))
{
SOSMethodData entry;
Expand Down
12 changes: 5 additions & 7 deletions src/SOS/Strike/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3644,7 +3644,7 @@ class SOSDacInterface15Simulator : public ISOSDacInterface15
unsigned int slotCount;
ULONG refCount;
public:
SOSMethodEnum(CLRDATA_ADDRESS mt) : pMT(mt), refCount(0)
SOSMethodEnum(CLRDATA_ADDRESS mt) : pMT(mt), refCount(1)
{
}

Expand Down Expand Up @@ -3769,18 +3769,16 @@ class SOSDacInterface15Simulator : public ISOSDacInterface15
ISOSMethodEnum **enumerator)
{
SOSMethodEnum *simulator = new(std::nothrow) SOSMethodEnum(mt);
*enumerator = simulator;
if (simulator == NULL)
{
return E_OUTOFMEMORY;
}
HRESULT hr = simulator->Reset();

if (SUCCEEDED(hr))
hr = simulator->QueryInterface(__uuidof(ISOSMethodEnum), (void**)enumerator);

if (FAILED(hr))
delete simulator;

{
simulator->Release();
}
return hr;
Comment on lines 3771 to 3782
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetMethodTableSlotEnumerator assigns *enumerator before validating the out-parameter and before knowing whether initialization succeeds. If Reset() fails, the code releases (and may delete) simulator but leaves *enumerator pointing at freed memory, and it will also AV if enumerator is null. Please validate enumerator (return E_POINTER), set *enumerator = nullptr on entry, and only publish the pointer on success (or explicitly null it after releasing on failure).

Copilot uses AI. Check for mistakes.
}
} SOSDacInterface15Simulator_Instance;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/inc/sospriv.idl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ interface ISOSDacInterface8 : IUnknown
// Increment anytime there is a change in the data structures that SOS depends on like
// stress log structs (StressMsg, StressLogChunck, ThreadStressLog, etc), exception
// stack traces (StackTraceElement), the PredefinedTlsSlots enums, etc.
cpp_quote("#define SOS_BREAKING_CHANGE_VERSION 6")
cpp_quote("#define SOS_BREAKING_CHANGE_VERSION 5")

[
object,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/pal/prebuilt/inc/sospriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ EXTERN_C const IID IID_ISOSDacInterface8;
/* interface __MIDL_itf_sospriv_0000_0012 */
/* [local] */

#define SOS_BREAKING_CHANGE_VERSION 6
#define SOS_BREAKING_CHANGE_VERSION 5


extern RPC_IF_HANDLE __MIDL_itf_sospriv_0000_0012_v0_0_c_ifspec;
Expand Down
Loading