Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CVE-2017-0208] Fix integer overflow in string.repeat
When using repeat API on javascript strings, we aren't checking for the upper cap of the length property. Fix: Instead of directly setting the length property in the constructor - We are now calling SetLength() - which also checks for the upper cap and throws OOM. i
- Loading branch information
1 parent
a8582a3
commit 54d6d08
Showing
4 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
try | ||
{ | ||
var str = "+".repeat(0x80000000); | ||
str = str.replace(str, "+"); | ||
|
||
WScript.Echo("FAIL: Was expecting Out of Memory exception."); | ||
} | ||
catch (e) | ||
{ | ||
if(e.number == -2146828281) //Out of Memory | ||
WScript.Echo("PASS"); | ||
else | ||
WScript.Echo("FAIL: Got the wrong exception code."); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters