MxSoundManager: use buffer size and don't rely on buffer capacity (#758)

This fixes a detect_container_overflow address sanitizer error.
This commit is contained in:
Anonymous Maarten 2026-01-01 01:25:44 +01:00 committed by GitHub
parent 6f192a3b1c
commit 7742fb0493
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -148,7 +148,9 @@ void MxSoundManager::AudioStreamCallback(
)
{
static vector<MxU8> g_buffer;
g_buffer.reserve(p_additionalAmount);
if (p_additionalAmount > g_buffer.size()) {
g_buffer.resize(p_additionalAmount);
}
MxSoundManager* manager = (MxSoundManager*) p_userdata;
ma_uint32 bytesPerFrame = ma_get_bytes_per_frame(ma_format_f32, ma_engine_get_channels(manager->m_engine));