mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibJS/Bytecode: Update NewArray stringifier to print a register range
NewArray now only contains two elements maximum in `m_elements` to indicate the range of registers to create the array from. However, `m_element_count` still contains how many registers are in the range and the stringifier was not updated to account for this. Thus, if the range contained more than 2 registers, it would do a read OOB on `m_elements`. This makes it now just print the first and second entries in `m_elements` in the format of `[<reg>-<reg>]`.
This commit is contained in:
parent
78f8821152
commit
741745baab
1 changed files with 1 additions and 7 deletions
|
@ -725,13 +725,7 @@ String NewArray::to_string_impl(Bytecode::Executable const&) const
|
|||
StringBuilder builder;
|
||||
builder.append("NewArray");
|
||||
if (m_element_count != 0) {
|
||||
builder.append(" [");
|
||||
for (size_t i = 0; i < m_element_count; ++i) {
|
||||
builder.appendff("{}", m_elements[i]);
|
||||
if (i != m_element_count - 1)
|
||||
builder.append(',');
|
||||
}
|
||||
builder.append(']');
|
||||
builder.appendff(" [{}-{}]", m_elements[0], m_elements[1]);
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue