From: Carl Worth Date: Fri, 24 Aug 2012 20:54:04 +0000 (-0700) Subject: retrace: Fix off-by-one error in detection of intersecting regions. X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=2473ca92aaa49ff2a70c9b931b5a3068d65844f7;p=apitrace retrace: Fix off-by-one error in detection of intersecting regions. 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 --- diff --git a/retrace/retrace_swizzle.cpp b/retrace/retrace_swizzle.cpp index 52d1d74..693fdfe 100644 --- a/retrace/retrace_swizzle.cpp +++ b/retrace/retrace_swizzle.cpp @@ -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);