]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Update comment about range checks with observations from Florian.
authorJulian Seward <jseward@acm.org>
Fri, 6 Mar 2015 09:19:38 +0000 (09:19 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 6 Mar 2015 09:19:38 +0000 (09:19 +0000)
No functional change.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14982

coregrind/m_debuginfo/image.c

index 964c6338a52fff9b1152b636d187fe09a481ccbb..819a77097ead5306b00e5ff3448d2a9964adac7b 100644 (file)
@@ -405,6 +405,12 @@ static inline Bool is_in_CEnt ( const CEnt* cent, DiOffT off )
          -->  x-LO >= 0 && x-LO < LO+N-LO
          -->  x-LO >= 0 && x-LO < N
          -->  x-LO < N
+      This is however only valid when the original bounds, that is, LO
+      .. LO+N-1, do not wrap around the end of the address space.  That
+      is, we require that LO <= LO+N-1.  But that's OK .. we don't
+      expect wraparounds in CEnts or for that matter any object
+      allocated from C-land.  See Hacker's Delight, Chapter 4.1,
+      "Checking Bounds of Integers", for more details.
    */
    return off - cent->off < cent->used;
 }