[speex-dev] bug found in speex_bits_read_whole_bytes

Thomas S thomas9920 at yahoo.com
Sun Aug 24 23:27:34 PDT 2003



Hello there,
I thought I would contribute to this wonderful project
but noting a simple but problematic bug in
speex_bits_read_whole_bytes().

SITUATION:
I have a large stream of frames with NO breaks or
length indicators inbetween each frame. For this
reason, I call speex_bits_read_whole_bytes() and fill
it to MAXIMUM in a loop while calling speex_decode()
until there are no more bytes to read. 

SYMPTOM:
You can only go up to MAX_BYTES_PER_FRAME-1 due an
incorrect calculation in the function.

LINES THAT ARE THE PROBLEM:
((bits->nbBits>>3)+len+1
should read
((bits->nbBits+7)>>3)+len
otherwise if nbBits is 0 or a full byte, the buffer
will never get to MAX_BYTES_PER_FRAME.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Speex-dev mailing list