Re: Oops... strange (to me) segfault problem



ElectricFence is really good at it. Tells you exactly where things went
wrong, not where the last straw fell.

http://perens.com/FreeSoftware

On Wed, Aug 04, 2004 at 02:23:27AM -0400, John Vetterli wrote:
It looks like you're corrupting the free store.

I suspect the first call to read() reads less than BLOCK_SZ bytes, in
which case offset gets incremented but the memory block doesn't get
resized, so the next call to read() overwrites the data after the end of
the memory block.  Perhaps if you removed the "if ( status == BLOCK_SZ )"
and resized the memory block unconditionally ???

Bye.
--
 Pawel S. Veselov [vps], Sun Microsystems, Inc.
 Staff Engineer, Java Mobile Systems and Services Engineering __ __(O) _ __
   (408) 276-5410   e-mail: Pawel Veselov Sun COM             \ V /| || '  \
fax(408) 276-6090 HomePage: http://manticore.2y.net            \_/ |_||_|_|_|




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]