🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #673

Re: Out-of-bounds pointers

#673
From: Doug Gwyn
Date: Fri, 06 Oct 1989 19:09
16 lines
1392 bytes
In article <12570028@hpclwjm.HP.COM> walter@hpclwjm.HP.COM (Walter Murray) writes:
-the wording of 3.3.6 might be misleading:  "Unless both the pointer
-operand and the result point to elements of the same array object,
-or the pointer operand points one past the last element of an array
-object and the result points to an element of the same array object,
-the behavior is undefined if the result is used as an operand of
-the unary * operator."  Doesn't this imply rather strongly that it
-IS legal to compute an invalid address, as long as it isn't
-dereferenced?

Not the way I read it in context, and certainly not the way it was
intended.  There are a lot of constraints on pointer arithmetic in
the same paragraph; the cited sentence is merely one more constraint.
It IS undefined behavior if you try to access some place outside the
actual array.  There are many other ways to obtain undefined behavior
during pointer arithmetic itself.
Technical Details
Message-ID: <11230@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn
References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: Out-of-bounds pointers
Message-ID: <11230@smoke.BRL.MIL>
Date: 6 Oct 89 19:09:03 GMT
References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 16