Commit 691bb621 authored by jdgleaver's avatar jdgleaver
Browse files

libretro: Increase size of allocated audio buffer

- It turns out that because the nominal size divided by number of channels is an odd number,
  potator can write past the end of the buffer when fetching samples. We therefore need
  additional padding. Note that this error is not detected by ASAN under Linux (!)
parent cf6edf6d
Pipeline #16766 failed with stages
in 1 minute and 20 seconds
......@@ -477,7 +477,11 @@ void retro_init(void)
video_buffer = (uint8_t*)malloc(VIDEO_BUFFER_SIZE * sizeof(uint8_t));
#endif
audio_buffer = (int16_t*)malloc(AUDIO_BUFFER_SIZE * sizeof(int16_t));
/* Round up actual size to nearest multiple of 128
* > Since (AUDIO_BUFFER_SIZE / 2) is an odd number,
* potator can write past the end of the buffer,
* so we need some extra padding... */
audio_buffer = (int16_t*)malloc(((AUDIO_BUFFER_SIZE + 0x7F) & ~0x7F) * sizeof(int16_t));
}
void retro_deinit(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment