[fpc-pascal] mysterious crashing, maybe related to setlength

David Emerson dle3ab at angelbase.com
Thu Sep 10 09:49:08 CEST 2009

Thanks, Jonas!

Just before I posted the other day, I had discovered a buffer overrun 
via range checking. I took care of it before writing my previous 
message. Maybe there is another buffer overflow that the range checker 
is somehow missing?

There IS a local dynamic array to be finalized, so this seems likely. 
However, range checking is not catching it, so I am stumped.


On Sun 6 Sep 2009, Jonas Maebe wrote:
> On 06 Sep 2009, at 10:16, David Emerson wrote:
> > My program is crashing, and I just can't figure out why. Heaptrc has
> > given me this rather cryptic info:
> >
> > Marked memory at $B79BA208 invalid
> > Wrong signature $000020D8 instead of 8E1C71B6
> It means that you probably have a buffer overrun somewhere.
> > Using lazurus's step-into functionality, I've it down to the line  
> > where
> > it's crashing -- seems to be crashing upon completion of a function.
> At the end of a function, all local variables are finalised. It's  
> probably finalising a local dynamic array (possibly the one you  
> mention below).
> > Alternately, I can get it to make a similar crash on setlength of a
> > dynamic array to length 0. (The array has refcount 1.)
> >
> > I haven't been able to reduce my code to anything reasonable;  
> > whenever I
> > cut out seemingly irrelevant/unrelated sections, the crashing stops.
> Have you tried compiling with range checking on? (-Cr)
> Jonas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list