Skip to content

Commit

Permalink
Throw out-of-bounds error from string SetLength
Browse files Browse the repository at this point in the history
Use a more appropriate error for out of bounds length in
JavascriptString::SetLength().

Closes chakra-core#6625
Closes chakra-core#6632
Closes chakra-core#6634
  • Loading branch information
ppenzin committed Mar 19, 2021
1 parent dd0d9ec commit 73199dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Runtime/Library/JavascriptString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace Js
{
if (!IsValidCharCount(newLength))
{
JavascriptExceptionOperators::ThrowOutOfMemory(this->GetScriptContext());
JavascriptError::ThrowRangeError(this->GetScriptContext(), JSERR_OutOfBoundString);
}
m_charLength = newLength;
}
Expand Down
6 changes: 3 additions & 3 deletions test/Error/outofmem.baseline
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Error
Out of memory
-2146828281
RangeError
String length is out of bound
-2146822618

0 comments on commit 73199dd

Please sign in to comment.