Fixes crashes on asan related to audio. (#4049)

Found in MM
This commit is contained in:
Kenix3 2024-07-17 14:35:13 -04:00 committed by GitHub
parent 79a29a62ef
commit 134aba4aa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,7 +100,13 @@ void aClearBufferImpl(uint16_t addr, int nbytes) {
} }
void aLoadBufferImpl(const void* source_addr, uint16_t dest_addr, uint16_t nbytes) { void aLoadBufferImpl(const void* source_addr, uint16_t dest_addr, uint16_t nbytes) {
#if __SANITIZE_ADDRESS__
for (size_t i = 0; i < ROUND_DOWN_16(nbytes); i++) {
BUF_U8(dest_addr)[i] = ((const unsigned char*)source_addr)[i];
}
#else
memcpy(BUF_U8(dest_addr), source_addr, ROUND_DOWN_16(nbytes)); memcpy(BUF_U8(dest_addr), source_addr, ROUND_DOWN_16(nbytes));
#endif
} }
void aSaveBufferImpl(uint16_t source_addr, int16_t *dest_addr, uint16_t nbytes) { void aSaveBufferImpl(uint16_t source_addr, int16_t *dest_addr, uint16_t nbytes) {