Menu

#3 Seg fault in 'subsampling' of psycho_I.c

open
nobody
None
5
2002-06-25
2002-06-25
No

When encoding a particular 24kHz sampled PCM file I
found that the 'subsampling' function within 'psycho_I.c'
produced a seg fault.

It appears that if the "while (i != LAST ) ..." loop at the
top of the function only executes once in this function, a
seg fault occurs because i is set to -100 (value of the
constant 'STOP') in the loop. At the beginning of the
next iteration, the function tries to access index -100 of
the array 'power', which produces the fault.

This problem is solved by changing the code from:
while (i != LAST)
{
...
}
to:
while ( (i != LAST) && (i != STOP) )
{
...
}
for each of the three 'while' loops within
the 'subsampling' function, and also the 'threshold'
function of 'psycho_I.c'.

Discussion

  • Duncan Chisholm

    Duncan Chisholm - 2002-06-25

    Ammended psycho_I.c. Changes next to /DJC/ comments

     
  • Duncan Chisholm

    Duncan Chisholm - 2002-06-25

    Ammended psycho_I.c. Changes next to /DJC/ comments

     
  • mikecheng

    mikecheng - 2003-02-13

    Logged In: YES
    user_id=141181

    There's a very hackish FIXLSF compile switch that was put in
    for version02i that sort of covers this for some cases, but
    not all. 02k will cover them all.

     

Log in to post a comment.