mirror of
https://github.com/gperftools/gperftools
synced 2025-02-27 09:30:25 +00:00
Fix result overflow in generic_fp stacktrace
In the 'with ucontext' case, the `skip_count` would be reset to 0, and `max_depth` should not be modified. Otherwise the result array would overflow.
This commit is contained in:
parent
c48d4f1407
commit
dad9e8ceb9
@ -123,8 +123,6 @@ int capture(void **result, int max_depth, int skip_count,
|
||||
int *sizes) {
|
||||
int i = 0;
|
||||
|
||||
max_depth += skip_count;
|
||||
|
||||
if (initial_pc != nullptr) {
|
||||
// This is 'with ucontext' case. We take first pc from ucontext
|
||||
// and then skip_count is ignored as we assume that caller only
|
||||
@ -137,6 +135,8 @@ int capture(void **result, int max_depth, int skip_count,
|
||||
i++;
|
||||
}
|
||||
|
||||
max_depth += skip_count;
|
||||
|
||||
constexpr uintptr_t kTooSmallAddr = 16 << 10;
|
||||
constexpr uintptr_t kFrameSizeThreshold = 128 << 10;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user