Skip to content

Commit 7b58ea9

Browse files
committed
libspeex: Replace our own OOB fix with upstream's chosen one
1 parent ee33787 commit 7b58ea9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vendor/libspeex/libspeex/vorbis_psy.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,17 @@ VorbisPsy *vorbis_psy_init(int rate, int n)
340340
if(halfoc<0)halfoc=0;
341341
if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
342342
inthalfoc=(int)halfoc;
343+
/*If we hit the P_BANDS-1 clamp above, inthalfoc+1 will be out of bounds,
344+
even though it will have an interpolation weight of 0.
345+
Shift the interval so we don't read past the end of the array.*/
346+
if(inthalfoc>=P_BANDS-2)inthalfoc=P_BANDS-2;
343347
del=halfoc-inthalfoc;
344348

345-
if (halfoc < P_BANDS-1) {
346349
p->noiseoffset[i]=
347350
p->vi->noiseoff[inthalfoc]*(1.-del) +
348351
p->vi->noiseoff[inthalfoc+1]*del;
349-
} else {
350-
p->noiseoffset[i]=
351-
p->vi->noiseoff[inthalfoc]*(1.-del);
352-
}
352+
353+
}
353354
#if 0
354355
_analysis_output_always("noiseoff0",ls,p->noiseoffset,n,1,0,0);
355356
#endif

0 commit comments

Comments
 (0)