Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_client.c:
if (FAILED(hr))
{
ERR("Failed to get element from sa1 with hr %#lx\n", hr);
return -1;
}
idx = lbound[1] + i;
hr = SafeArrayGetElement(sa2, &idx, &val[1]);
if (FAILED(hr))
{
ERR("Failed to get element from sa2 with hr %#lx\n", hr);
return -1;
}
if (val[0] != val[1])
return val[0] - val[1];
I'm not sure this actually works for a comparison function. `val` is an int, and the result is an int, so the subtraction here could overflow or underflow.