Closed JJ-8 closed 8 months ago
Hello,
I don't know how activation could fail, however, I will fix the bug and deploy the new package soon, unless you want to make a PR with the fix that I will be happy to accept.
Thanks
Hi @m1dugh, thank you for the quick response! It would be great if you could fix this issue since then I don't have to setup the development environment :)
Hi, first of all thank you for this very useful project :)
I think I have found a bug in the source code which causes a null pointer dereference:
From: https://github.com/m1dugh/native-sound-mixer/blob/master/cppsrc/win/win-sound-mixer.cpp#L308-L315
According to https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-immdevice-activate the
endpointVolume
could be NULL when theActivate
call fails. However, the return value is not checked and laterendpointVolume->RegisterControlChangeNotify(device_cb);
is done. WhenendpointVolume
is NULL, this causes a null pointer dereference. I have no test case to reproduce this behavior because I am only seeing this from production users by collecting crashes. In case it might be useful for you, here is a snippet of the native crash dump:This is the instruction on where it fails:
mov rax, [rcx]
. You can clearly see thatrcx
is set to 0x0 which being dereferenced.I don't know the code well enough to know how to handle this case. Do you maybe now why
Activate
could fail?