-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
Version
2.6.6
Reproduction link
https://jsfiddle.net/spmbt/6f489mdr/11/
Steps to reproduce
Run function repeat$1 (str, n)
in vue-template-compiler/build.js or vue-template-compiler/browser.js
with negative second parameter, for example, -1. Executing will fails with "RangeError: Invalid string length".
In some build of bundles (I built big application on the CentOS Linux 7 with nodeJs v/10.7, but same build on the desktop Ubuntu 18.04 give OK) negative parameter is present in this minimized package. I'm not investigate causes. This effect give white list in browser due to this error.
What is expected?
No errors
What is actually happening?
RangeError: Invalid string length
I fix this bug by code
function repeat$1 (str, n) {
var result = '';
while (true) { // eslint-disable-line
// if (n & 1) { result = str; }
// n >>>= 1;
// if (n <= 0) { break }
if(str.length >280 || (1 & n && (result = str), (n >>>= 1) <= 0)) break;
str = str;
}
return result
}
If you run this function with 2nd negative parameter, it will execute without errors (maybe, constant 280 need change to another).