TooTallNate / node-speaker

Output PCM audio data to the speakers
648 stars 145 forks source link

Heap Corruption on Windows #117

Open killerDJO opened 6 years ago

killerDJO commented 6 years ago

Summary: Heap is corrupted due to an implementation of the "device" option and process is subsequently crushes.

Steps to reproduce: Use Speaker on Windows.

Affected version: 0.4.1

Workaround: Use speaker@0.4.0.

Additional info: device is conditionally set on the binding.cc:34 and freed on the binding.cc:107. There are 2 issues with this implementation:

  1. device might not be provided from user and not allocated in the Open method, but Close method will try to deallocate it nevertheless, which would lead to a heap corruption.
  2. open method on audio_output (binding.cc:44) does not respected the provided device and will always replace it with a statically allocated "WaveMapper" string (win32.c:61). This makes "device" property effectively useless on Windows.
Holayn commented 4 years ago

bless ur soul