[mb-devel] Possible Client SDK code bug
Robert Kaye
rob at eorbit.net
Tue Oct 24 18:53:16 UTC 2006
On Oct 23, 2006, at 3:07 PM, Andy Bridle wrote:
>
> Well, it still looks wrong to me. I know it's increasing the buffer
> size,
> but it's not increasing it enough. If (kBufferSize < size) it only
> increases
> the buffer size by kBufferSize, and then appends 'size' characters
> to it.
> This corrupts the heap. This isn't picked up by the memcpy (hence
> memcpy now
> being deprecated by MS), but it is detected when the 'delete []
> m_buffer' is
> done next time through.
OK, I see your point. But I would suggest this alternative:
m_bufferSize += ((size / kBufferSize) + 1) * kBufferSize;
This should always keep the m_BufferSize a multiple of kBufferSize
while keeping it large enough. If this wasn't my goal originally, it
should've been. :)
What do you think? Can you try the new code to see if it crashes for
you?
--
--ruaok Somewhere in Texas a village is *still* missing its idiot.
Robert Kaye -- rob at eorbit.net -- http://mayhem-chaos.net
More information about the MusicBrainz-devel
mailing list