Skip to content

Commit

Permalink
[BOLT] Do not assert on bad data
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
rafaelauler authored and maksfb committed Jan 29, 2018
1 parent 626e977 commit 4837074
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bolt/BinaryFunctionProfile.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 4837074

Please sign in to comment.