PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

InitializeOutputStream() in pa_opensles.c cause crash! #823

Closed AngenimyWhu closed 1 year ago

AngenimyWhu commented 1 year ago

(Please use the mailing list for support requests and general discussion. This is only for actual bugs.)

Describe the bug A malloc size error in InitializeOutputStream() at line 901.

To Reproduce Steps to reproduce the behavior. Include code if applicable.

  1. use audio stream with s16le, which stream->outputStream->bytesPerSample = 2 & numberOfBuffers = 2;
  2. malloc 4 bytes;
  3. However, stream->outputStream->outputBuffers[0] & stream->outputStream->outputBuffers[1] is total 8 bytes;
  4. So, stream->outputStream->outputBuffers[1] cause "Heap buffer overflow";
  5. Probability of memory exceptions when memset is triggered later;

Expected behavior memory malloc right!

Actual behavior Crash in android devices, when we use it in ndk!

Note: PortAudio is a community supported project. If you have a solution, please create a Pull Request for us to consider.

AngenimyWhu commented 1 year ago

sorry, This is code provided by others, unofficial