[PATCH] D85378: Fix off-by-one error in size of the required shadow memory passed to `MapDynamicShadow`.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 12:11:04 PDT 2020


delcypher added a comment.

@vitalybuka Do I need to worry about overflow here, i.e. kHighMemEnd is `ULONG_MAX` on some platform in which case we'd overflow and therefore ask for a shadow size of `0`?

I could do `MemToShadowSize(kHighMemEnd) + 1` instead which gives the same result in the non-overflow case because of how `kHighMemEnd` is set (see `InitializeHighMemEnd()`) **and it would avoid the overflow case**. It's harder to understand though because the reader needs to know about the properties of the lower bits in `kHighMemEnd`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85378/new/

https://reviews.llvm.org/D85378



More information about the llvm-commits mailing list