1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 03:09:51 +03:00
aports/testing/sfizz/sfizz-1314_fix-crash-in-fillinterpolated.patch
2025-05-16 19:17:27 +00:00

32 lines
1.3 KiB
Diff

From a0f3b6c184d63153f5981d0b55f68f8242ddfc5f Mon Sep 17 00:00:00 2001
From: leso-kn <info@lesosoftware.com>
Date: Wed, 9 Apr 2025 12:54:21 +0200
Subject: [PATCH] Fix crash in Voice::Impl::fillInterpolated()
Recent versions of abseil assert on possible buffer overflow
---
src/sfizz/Voice.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp
index e5233aacd..681b6ea5f 100644
--- a/src/sfizz/Voice.cpp
+++ b/src/sfizz/Voice.cpp
@@ -1369,6 +1369,8 @@ void Voice::Impl::fillInterpolated(
auto left = dest.getChannel(0);
if (source.getNumChannels() == 1) {
while (ind < indices.end()) {
+ if ((size_t)*ind >= leftSource.size())
+ break;
auto output = interpolate<M>(&leftSource[*ind], *coeff);
IF_CONSTEXPR(Adding) {
float g = *addingGain++;
@@ -1382,6 +1384,8 @@ void Voice::Impl::fillInterpolated(
auto right = dest.getChannel(1);
auto rightSource = source.getConstSpan(1);
while (ind < indices.end()) {
+ if ((size_t)*ind >= leftSource.size() || (size_t)*ind >= rightSource.size())
+ break;
auto leftOutput = interpolate<M>(&leftSource[*ind], *coeff);
auto rightOutput = interpolate<M>(&rightSource[*ind], *coeff);
IF_CONSTEXPR(Adding) {