From 48370744d98e1855557c91285ae3c911f6b186c0 Mon Sep 17 00:00:00 2001 From: Rafael Auler Date: Mon, 29 Jan 2018 10:37:30 -0800 Subject: [PATCH] [BOLT] Do not assert on bad data Summary: A test is asserting on impossible addresses coming from perf.data, instead of just reporting it as bad data. Fix this behavior. (cherry picked from FBD6835590) --- bolt/BinaryFunctionProfile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bolt/BinaryFunctionProfile.cpp b/bolt/BinaryFunctionProfile.cpp index 30dc96e72ae5..78ce9444c3a6 100644 --- a/bolt/BinaryFunctionProfile.cpp +++ b/bolt/BinaryFunctionProfile.cpp @@ -307,9 +307,8 @@ bool BinaryFunction::recordEntry(uint64_t To, bool Mispred, uint64_t Count) { } bool BinaryFunction::recordExit(uint64_t From, bool Mispred, uint64_t Count) { - if (!isSimple()) + if (!isSimple() || From > getSize()) return false; - assert(From <= getSize() && "wrong From address"); if (!hasProfile()) ExecutionCount = 0;