From 8a36bf5c09e6ca2ea6bab336869cf2e9a4ccb1e4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 30 Apr 2017 11:45:57 +0300 Subject: [PATCH] Fixed potential crash in sndfile reader on Intel platform https://mantis.zdoom.org/view.php?id=640 --- src/sound/sndfile_decoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sound/sndfile_decoder.cpp b/src/sound/sndfile_decoder.cpp index a46f0146b..fd89aa2bc 100644 --- a/src/sound/sndfile_decoder.cpp +++ b/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(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;