]> git.cworth.org Git - apitrace/commitdiff
retrace: Fix off-by-one error in detection of intersecting regions.
authorCarl Worth <cworth@cworth.org>
Fri, 24 Aug 2012 20:54:04 +0000 (13:54 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 10 Oct 2012 15:16:38 +0000 (16:16 +0100)
The upperBound functions returns the first region beyond the region
containing the given address. So, to correctly use it here, we must
give it the last valid address of the current range, which is just
less than (address + size).

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
retrace/retrace_swizzle.cpp

index 52d1d74dfd251eeb20cc9ce8c462a4f81a970313..693fdfeb375a5bbd9fd315801a3717ca973d3db8 100644 (file)
@@ -108,7 +108,7 @@ addRegion(unsigned long long address, void *buffer, unsigned long long size)
 
 #ifndef NDEBUG
     RegionMap::iterator start = lowerBound(address);
-    RegionMap::iterator stop = upperBound(address + size);
+    RegionMap::iterator stop = upperBound(address + size - 1);
     if (0) {
         // Forget all regions that intersect this new one.
         regionMap.erase(start, stop);