At 9:01 AM -0800 1/18/02, Steve Mann wrote: >>Pose usually complains about subtle memory errors. I'm not sure if it >>specifically detects array over-bounding. (Keith, any comments?) > >If it did, it could have saved me some work. :-) > >Usually this is a compiler-handled problem. POSE probably has no >idea what the bounds are on arrays.
True, it doesn't have that information. But one area where Poser can currently help is if the array is in a dynamically allocated heap chunk. If the array access overflows into the the following chunk's header structure, Poser will complain about that. As well, if the following heap chunk is unlocked or unallocated and the access falls into it, then Poser will complain. There are two other ideas on my list where Poser can -- but currently doesn't -- help: * Check for accesses where a base pointer points into one heap object, but the final, indexed memory address is in a different heap object. That would take care of the case where the errant access happens to fall into a valid heap chunk, albeit the incorrect one. * Check for accesses to proscribed areas of the stack above the stack pointer. Poser already checks for accesses below the stack pointer, which can catch cases where you use negative indexes and the array is located near the stack pointer. But the additional check could catch accesses to, say, the return address or previous stack frame pointer stored on the stack. -- -- Keith Rollin -- Palm OS Emulator engineer -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
