findGrep() causes Indesign to hang and consume all available resources, eventually crashing the entire computer
This code will cause InDesign 17.1 to hang and consume all available resources until the computer eventually runs out of both real and virtual memory and then crashes.
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findChangeGrepOptions.properties = { includeMasterPages: true, kanaSensitive: true, widthSensitive: true };
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '^(.*)$';
var found = app.documents[0].changeObject.findGrep();
If the runaway app is terminated using Task Manager (Windows 10), a stack of message boxes appear with the following message:
Unable to terminate process
The operation could not be completed
The operation is not valid for this process