Skip to content

Commit eb33e3a

Browse files
committed
Fix potential crashes when using string to equalizer string
1 parent 6912a4b commit eb33e3a

File tree

2 files changed

+6
-0
lines changed
  • Audio_Engine
    • eclipse_libjamesdsp_double/jni
    • eclipse_libjamesdsp_many_bands_Lollipop_Marshmallow_Nougat_PartialMultithread/jni

2 files changed

+6
-0
lines changed

Audio_Engine/eclipse_libjamesdsp_double/jni/ArbFIRGen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ void InitArbitraryEq(ArbitraryEq* eqgain, int *filterLength, int isLinearPhase)
370370
eqgain->freqData = fftw_alloc_complex(eqgain->fLMul2);
371371
eqgain->filterLength = *filterLength;
372372
eqgain->isLinearPhase = isLinearPhase;
373+
eqgain->nodes = 0;
373374
eqgain->nodesCount = 0;
374375
if (!isLinearPhase)
375376
{
@@ -548,6 +549,8 @@ void ArbitraryEqString2SortedNodes(ArbitraryEq *eqgain, char *frArbitraryEqStrin
548549
{
549550
count++;
550551
double val = strtod(counter, &counter);
552+
if (i == numOfNodes)
553+
break;
551554
if (count % 2)
552555
{
553556
nodes[i]->gain = val;

Audio_Engine/eclipse_libjamesdsp_many_bands_Lollipop_Marshmallow_Nougat_PartialMultithread/jni/ArbFIRGen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ void InitArbitraryEq(ArbitraryEq* eqgain, int *filterLength, int isLinearPhase)
370370
eqgain->freqData = fftwf_alloc_complex(eqgain->fLMul2);
371371
eqgain->filterLength = *filterLength;
372372
eqgain->isLinearPhase = isLinearPhase;
373+
eqgain->nodes = 0;
373374
eqgain->nodesCount = 0;
374375
if (!isLinearPhase)
375376
{
@@ -548,6 +549,8 @@ void ArbitraryEqString2SortedNodes(ArbitraryEq *eqgain, char *frArbitraryEqStrin
548549
{
549550
count++;
550551
float val = strtod(counter, &counter);
552+
if (i == numOfNodes)
553+
break;
551554
if (count % 2)
552555
{
553556
nodes[i]->gain = val;

0 commit comments

Comments
 (0)