Permalink
Browse files

Fixed potential crash in sndfile reader on Intel platform

  • Loading branch information...
alexey-lysiuk committed Apr 30, 2017
1 parent 4c803b6 commit 8a36bf5c09e6ca2ea6bab336869cf2e9a4ccb1e4
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/sound/sndfile_decoder.cpp
@@ -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;

0 comments on commit 8a36bf5

Please sign in to comment.