Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!ginosko!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
Keywords: ANSI C, hardware protection, out-of-bounds pointers
Message-ID: <10970@smoke.BRL.MIL>
Date: 7 Sep 89 11:09:42 GMT
References: <427@maytag.waterloo.edu> <867@hadron.UUCP>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 10

In article <867@hadron.UUCP> jsdy@hadron.UUCP (Joseph S. D. Yao) writes:
>-	char *head=a-1;		/* Here! */
>This, too, is an out-of-bounds pointer, and is covered by the same
>rule.  Nothing says that an OOB ptr has to be positively offset.

Sorry, Joe, but you're wrong.  Only the last+1 OOB pointer is legal,
not the first-1.  I've seen this fail in practice (in AT&T's UNIX
implementation of bsearch(), as I recall) when the array element
was fairly large and first-1 happened to wrap around the address
space.