Commit d408e982 authored by Mike Wittman's avatar Mike Wittman Committed by Commit Bot

[Sampling profiler] Avoid underflow in OS X rbp check

When rbp was less than the offset, the check was underflowing and
incorrectly passing. Add a check for rbp < offset to detect this
situation.

Bug: 831448
Change-Id: I4f780c1573782af3ca29b0f814e93ff2dca839f2
Reviewed-on: https://chromium-review.googlesource.com/1013213Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Mike Wittman <wittman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551113}
parent 1fbcaf20
...@@ -328,8 +328,8 @@ bool WalkStackFromContext( ...@@ -328,8 +328,8 @@ bool WalkStackFromContext(
unw_word_t rsp, rbp; unw_word_t rsp, rbp;
unw_get_reg(&unwind_cursor, UNW_X86_64_RSP, &rsp); unw_get_reg(&unwind_cursor, UNW_X86_64_RSP, &rsp);
unw_get_reg(&unwind_cursor, UNW_X86_64_RBP, &rbp); unw_get_reg(&unwind_cursor, UNW_X86_64_RBP, &rbp);
uint32_t offset = GetFrameOffset(proc_info.format); uint32_t offset = GetFrameOffset(proc_info.format) * sizeof(unw_word_t);
if ((rbp - offset * 8) < rsp || rbp > stack_top) { if (rbp < offset || (rbp - offset) < rsp || rbp > stack_top) {
return false; return false;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment