LMMS / LMMS/lmms

LADSPA Caps Amp effect crash when FPE debugging enabled

Open
#5,882 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Bug Summary

When loading any demo projects containing the LADSPA CAPS Amp effect, LMMS crashes.

Steps to reproduce
  1. Build master with FPE debugging enabled
  2. Run LMMS
  3. Load a demo project (for example demos/CapDan/CapDan-TwilightArea-OriginalByAlf42red.mmpz)
Expected behavior

LMMS loads the demo project

Actual behavior

LMMS crashes during load of demo project

Affected LMMS versions

LMMS 1.3.0-alpha.1.65+g623e35ca2
Unknown how further back this crash affects.

Logs

@PhysSong and myself start searching for clues starting here: discord message of gdb backtrace
I tracked it back to this line.
Following that @PhysSong tracked down an update fixing the function in CAPS 0.9.25.

Small backport of the function and I can load demos successfully.

diff --git a/plugins/LadspaEffect/caps/dsp/windows.h b/plugins/LadspaEffect/caps/dsp/windows.h
index 949a95818..44a4cd734 100644
--- a/plugins/LadspaEffect/caps/dsp/windows.h
+++ b/plugins/LadspaEffect/caps/dsp/windows.h
@@ -142,13 +142,14 @@ kaiser (sample_t * s, int n, double beta)
        double bb = besseli (beta);
        int si = 0;
 
-       for (double i = -n / 2 + .1; si < n; ++si, ++i)
+       for (double i = -n / 2. + .5; si < n; ++si, ++i)
        {
-               double k = besseli ((beta * sqrt (1 - pow ((2 * i / (n - 1)), 2)))) / bb;
+               double a = 1 - pow((2 * i / (n - 1)), 2);
+               double k = besseli ((beta * (a < 0 ? 0 : sqrt(a)))) / bb;
 
                /* can you spell hack */
-               if (!isfinite (k) || isnan(k))
-                       k = 0;
+               /*if (!isfinite (k) || isnan(k))
+                       k = 0;*/
 
                F (s[si], k);
        }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in plugins/LadspaEffect/caps/dsp/windows.h at the kaiser function and compare it with the CAPS 0.9.25 update linked in the issue. Build LMMS with FPE debugging enabled, then load demos/CapDan/CapDan-TwilightArea-OriginalByAlf42red.mmpz; done means the project loads without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.