On Sat, May 02, 2009 at 08:42:41PM +0200, Laurent Aimar wrote:
On Sat, May 02, 2009, Kostya wrote:
On Sat, May 02, 2009 at 08:03:17PM +0200, Laurent Aimar wrote:
On Sat, May 02, 2009, Kostya wrote:
I thought that the bitstream layer ensured that no read could go beyond the provided buffer. Looking at get_bits.h it does not seems to, so I have attached a patch that check that the provided buffer is wide enought.
Why not check it once during initialization? Decoder always read extra_bits*channels*samples+32, doesn't it? From wv docs, it does not seems that the order of the chunks is imposed, so I cannot suppose that INT32INFO (needed to know the number of bits) is received before EXTRA_BITS.
On the second thought this check is not really needed - we may be more or less sure that we got right CRC so wrong bits will be catched by it. That's not the issue, get_bits cannot be called if the buffer is not wide enough (at least it is my understanding). Checking it for each sample is an overkill IMO. It is not what I do, the check is done only once per input packet.
You can always check that after all chunks are parsed but before real decode has started but It is done like that, sorry if I wasn't clear, I just meant that I had to wait for all chunks to be parsed as I cannot check it when I received the EXTRA_BITS one.
It's get_bits_count() call that got me confused (so I thought it is called regularly during samples decoding). Applied.
-- fenrir