Richard Frith-Macdonald <richard@brainstorm.co.uk> writes:
On 18 Jan 2006, at 11:16, Wim Oudshoorn wrote:
No, I mean 1. But that is just to try to make the problem simple
to grasp.
In practice, take the following example:
BUFSIZ = 1024
extra = 0
bsize = 1024 (it will be this value before the first GROW call)
dpos = 1023
sl = 1
dest = 0
However, it looks like that is an impossible example, since the code
says
if (dst == 0 || *size == 0)
{
ptr = buf;
bsize = (extra != 0) ? BUFSIZ - 1 : BUFSIZ;
}
Yes, that is the case when setting up. That is why bsize in the
first
run is equal to BUFSIZ. This is NOT the code in the GROW macro,
which will will do: ptr -= BUFSIZ.
Am I missing something here?
I think so. I am quite convinced I am right. But even when I am
convinced I have been proven wrong before ;-(
Do you have any code to demonstrate the problem actually happening?
Hm our application? But than, of course that is not a simple test
program.
At the moment I am really struggling with a very nasty memory
corruption problem
in a multithreaded environment. Grrr. So I won't have time to write
a small test application. But even a small test application does
not prove
anything. I could well be that it corrupts an innocent part of
thes stack.