Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: ANSI C, hardware protection, out-of-bounds pointers Message-ID: <10997@smoke.BRL.MIL> Date: 9 Sep 89 01:29:49 GMT References: <427@maytag.waterloo.edu> <1989Sep5.175411.25203@utzoo.uucp> <9520@chinet.chi.il.us> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <9520@chinet.chi.il.us> kdb@chinet.chi.il.us (Karl Botts) writes: >Any standard implementation of malloc() et al. puts either the size >of the block or a pointer to the next block in the machine word just >before the start of the block ... Not true. A "buddy system" allocator is MOST unlikely to do so. >Thus you can be sure that mentioning this word (or even dereferencing it) >will not cause an exception. Even in such cases, it still wouldn't help with arrays of large objects, because first-1 would point many bytes below the start of the allocated data block. Just don't use first-1. It's not that hard to avoid.