Skip to content

Commit

Permalink
Add sanity check for filter parameters (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Jun 7, 2024
1 parent 7f980a9 commit e6b4969
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo)
cerr << "Recommended filter range: " << frange << endl;
}

if ((frange < 0.0) || (frange > 1.0))
{
cerr << "Invalid 6581 filter range: " << frange << endl;
exit(EXIT_FAILURE);
}

if (m_verboseLevel)
cerr << "6581 filter range: " << frange << endl;
rs->filter6581Range(frange);
Expand All @@ -638,6 +644,12 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo)
fcurve = m_fcurve;
}

if ((fcurve < 0.0) || (fcurve > 1.0))
{
cerr << "Invalid 6581 filter curve: " << fcurve << endl;
exit(EXIT_FAILURE);
}

if (m_verboseLevel)
cerr << "6581 filter curve: " << fcurve << endl;
rs->filter6581Curve(fcurve);
Expand All @@ -649,6 +661,12 @@ bool ConsolePlayer::createSidEmu (SIDEMUS emu, const SidTuneInfo *tuneInfo)
fcurve = m_fcurve;
}

if ((fcurve < 0.0) || (fcurve > 1.0))
{
cerr << "Invalid 8580 filter curve: " << fcurve << endl;
exit(EXIT_FAILURE);
}

if (m_verboseLevel)
cerr << "8580 filter curve: " << fcurve << endl;
rs->filter8580Curve(fcurve);
Expand Down

0 comments on commit e6b4969

Please sign in to comment.