Fixed potential crash in sndfile reader on Intel platform

https://mantis.zdoom.org/view.php?id=640
This commit is contained in:
alexey.lysiuk 2017-04-30 11:45:57 +03:00
parent 4c803b6615
commit 8a36bf5c09

View file

@ -163,7 +163,10 @@ size_t SndFileDecoder::read(char *buffer, size_t bytes)
while(total < frames)
{
size_t todo = MIN<size_t>(frames-total, 64/SndInfo.channels);
float tmp[64];
// libsndfile uses SSE optimization on Intel platform
// This requires proper read buffer alignment
alignas(16) float tmp[64];
size_t got = (size_t)sf_readf_float(SndFile, tmp, todo);
if(got < todo) frames = total + got;