Comment 5 for bug 235984

Revision history for this message
olo (zulumantee) wrote :

he people, i made a fix for this problem and i am going to test some mono and stereo ogg vorbis files in order to verify that everything still works.
i will post the patch then later today.

the problem was that the "index" variable used in "SoundSourceOggVorbis::read" is supposed to be the byte index for the "destination"
buffer which means that in can address 2*size bytes because the destination buffer holds size*16bit values.

when the read loop reaches the end of the file, the "destination" buffer is normally not filled completely and one tries to fill the remaining
space with zeros. in this case, the "index" variable is used again but to address the single 16bit value in the buffer. now index becomes too
large and exceeds the "size" value which causes the segmentation fault.

the reasons for that is that the "fill with zero" loop runs until the variable "needed" becomes zero. "needed" defines the remaining bytes to
put in the buffer and addresses 2*size bytes as well. in every loop run, index gets increased by one and finally exceeds the "size" of the
destination buffer.

i have two versions of the fix, one that still fills the buffer with zeros when the end of the file is reached and one that skips this part because the
amount of read samples is always returned to the "BpmDetector::run" function, from which "read" is called, and only that amount of samples is used
there further.

anyway, i will post the two versions of the patch soon today. peace olo