[speex-dev] bug found in speex_bits_read_whole_bytes
Jean-Marc Valin
Jean-Marc.Valin at USherbrooke.ca
Mon Aug 25 22:41:34 PDT 2003
OK, I fixed it but:
1) you shouldn't be using the MAX_BYTES_PER_FRAME constant (just moved
it to the .c where it belongs)
2) if you read more than MAX_BYTES_PER_FRAME the buffer will resize
automatically, so there's no problem. Just use the size you want.
Jean-Marc
Le lun 25/08/2003 à 02:27, Thomas S a écrit :
> 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.
--
Jean-Marc Valin, M.Sc.A., ing. jr.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada
--- >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