audio/zynaddsubfx: Fix buffer overflows

- Leave room for termination NUL in sscanf buffer.
- Use float instead of float_t.  On FreeBSD/i386 they are not the same.

Discovered during an exp-run for bug 276478.
2024Q2
Tijl Coosemans 2024-02-25 12:16:43 +01:00
parent 9827f3b510
commit 0eb74bac9c
4 changed files with 34 additions and 1 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= zynaddsubfx
DISTVERSION= 3.0.6
PORTREVISION= 2
PORTREVISION= 3
PORTEPOCH= 2
CATEGORIES= audio

View File

@ -0,0 +1,11 @@
--- rtosc/src/cpp/savefile.cpp.orig 2021-12-31 15:58:28 UTC
+++ rtosc/src/cpp/savefile.cpp
@@ -534,7 +534,7 @@ int load_from_file(const char* file_content,
n = 0;
sscanf(file_content,
- "%% %128s v%u.%u.%u%n ", appbuf, &vma, &vmi, &vre, &n);
+ "%% %127s v%u.%u.%u%n ", appbuf, &vma, &vmi, &vre, &n);
if(n <= 0 || strcmp(appbuf, appname) || vma > 255 || vmi > 255 || vre > 255)
return -bytes_read-1;

View File

@ -0,0 +1,11 @@
--- src/Effects/Distorsion.cpp.orig 2022-01-22 01:46:21 UTC
+++ src/Effects/Distorsion.cpp
@@ -75,7 +75,7 @@ rtosc::Ports Distorsion::ports = {
for(int i=0; i<128; ++i)
buffer[i] = 2*(i/128.0)-1;
- memcpy(orig, buffer, sizeof(float_t)*128);
+ memcpy(orig, buffer, sizeof(buffer));
waveShapeSmps(sizeof(buffer)/sizeof(buffer[0]), buffer,
dd.Ptype + 1, dd.Pdrive, dd.Poffset, dd.Pfuncpar);

View File

@ -0,0 +1,11 @@
--- src/Synth/ADnote.cpp.orig 2022-01-22 01:46:21 UTC
+++ src/Synth/ADnote.cpp
@@ -1264,7 +1264,7 @@ inline void ADnote::ComputeVoiceOscillator_SincInterpo
inline void ADnote::ComputeVoiceOscillator_SincInterpolation(int nvoice)
{
// windowed sinc kernel factor Fs*0.3, rejection 80dB
- const float_t kernel[] = {
+ const float kernel[] = {
0.0010596256917418426f,
0.004273442181254887f,
0.0035466063043375785f,