mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 07:22:22 +00:00
LibJS: Avoid crash on empty stack trace
We were trying to stringify the stack trace without the last element, leading to a loop bound of (size_t)(0 - 1) and accessing m_traceback[0] out-of-bounds. Instead, just return an empty string in that case. Fixes #21747
This commit is contained in:
parent
38531ce7cf
commit
1030776f92
Notes:
sideshowbarker
2024-07-17 04:10:16 +09:00
Author: https://github.com/skyrising
Commit: 1030776f92
Pull-request: https://github.com/SerenityOS/serenity/pull/21748
Issue: https://github.com/SerenityOS/serenity/issues/21747
1 changed files with 3 additions and 0 deletions
|
@ -93,6 +93,9 @@ void Error::populate_stack()
|
|||
|
||||
String Error::stack_string(CompactTraceback compact) const
|
||||
{
|
||||
if (m_traceback.is_empty())
|
||||
return {};
|
||||
|
||||
StringBuilder stack_string_builder;
|
||||
|
||||
// Note: We roughly follow V8's formatting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue