mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Add check on ^ $ and .* to avoid regex crash
This commit is contained in:
@@ -2831,6 +2831,15 @@ var ICEcoder = {
|
||||
findReplace: function(find, selectNext, canActionChanges, findPrevious) {
|
||||
let replace, results, thisCM, thisSelection, rBlocks, rExpMatch0String, replaceQS, targetQS, filesQS;
|
||||
|
||||
// Return early if we're finding with regex and only have ^ or $ or .*, avoids CPU crash
|
||||
if (true === parent.ICEcoder.findRegex && "" === find.replace(/\^|\$|\.\*/g, "")) {
|
||||
results.innerHTML = "No results";
|
||||
this.content.contentWindow.document.getElementById('resultsBar').innerHTML = "";
|
||||
this.content.contentWindow.document.getElementById('resultsBar').style.display = "none";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine our find rExp, replace value and results display
|
||||
const rExp = new RegExp(true === parent.ICEcoder.findRegex ? find : ICEcoder.escapeRegex(find), "gi");
|
||||
replace = get('replace').value;
|
||||
|
||||
Reference in New Issue
Block a user