mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Use array element count instead of memory size in backtrace call
The backtrace execinfo API takes the number of addresses the result buffer can hold instead of its size, for some reason. Previously backtraces larger than 256 frames deep would write past the end of the result buffer.
This commit is contained in:
parent
ec8330b647
commit
702dd0ca55
Notes:
sideshowbarker
2024-07-17 16:23:55 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/702dd0ca55 Pull-request: https://github.com/SerenityOS/serenity/pull/21621
1 changed files with 1 additions and 1 deletions
|
@ -41,7 +41,7 @@ ALWAYS_INLINE void dump_backtrace()
|
|||
{
|
||||
// Grab symbols and dso name for up to 256 frames
|
||||
void* trace[256] = {};
|
||||
int const num_frames = backtrace(trace, sizeof(trace));
|
||||
int const num_frames = backtrace(trace, array_size(trace));
|
||||
char** syms = backtrace_symbols(trace, num_frames);
|
||||
|
||||
for (auto i = 0; i < num_frames; ++i) {
|
||||
|
|
Loading…
Reference in a new issue