mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +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
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