This simple batch file in relatively short order consumes all available memory on Windows 7 (x64). What\'s going on? and what precautions can be taken to ward against it?
<
The cause of this (from my understanding) is due to the cmd interpreter looking for a character to escape since the ^
is the batch escape character. Instead of properly identifying the end of file eof
in this scenario, cmd just keeps looping and initializing something while looking for the character to escape.
Reproduced on Windows 8 Pro (64) with cc^^^
(Multiple carets used to speed up the leak).
cc^
infinite loop and leaks very slowly.
cc^^
crashes with normal invalid command error.
cc^^^
infinite loop and leaks faster.
cc ^
infinite loop and leaks very slowly.
cc ^^
crashes with normal invalid command error.
cc ^^^
infinite loop and leaks faster.
cc"^
crashes with normal invalid command error.
cc"^^
crashes with normal invalid command error.
cc"^^^
crashes with normal invalid command error.
^
are used literally (outside of quotations). When quotation added the script crashes with standard invalid command error.^
(0x5E) or at least an odd number of carets.