trusktr trusktr - 4 months ago 18
HTML Question

How do you force Flash to crash for testing?

I need to test flash crashing in Chrome... Anyone know how to make Flash crash or have a Flash movie file that crashes on purpose?

EDIT: After messing around with my app, I determined that what I really need is a way to test when a Chrome tab crashes, and I discovered that trying to visit

chrome://crash/
in any CHrome tab will do the trick. I was really just trying to crash a Chrome tab and thought I could do it with Flash, but it turns it to be much simpler than that. I have still chosen an answer below.

Answer

An infinite loop will choke up Flash for about 15 seconds, after which the AVM will forcibly stop execution of the offending code block. This does NOT stop the AVM from executing other code, or completely crash it.

Before Flash Player 10.3, if you really wanted to murder a web browser with Flash, there were a couple ways to do it. One was...

var n:Vector.<int> = new Vector.<int>(-1);

another was...

var n:ByteArray = new ByteArray();
n.length = int.MAX_VALUE;

The ByteArray one is guaranteed death to any browser if you're running FP 10.2 or less. Since 10.3, however, it now throws a catchable error (#1000, out of memory) and continues to execute other code.

Since FP 10.3, the Vector method stops ALL code execution in its tracks without throwing an error. But it no longer crashes the browser; now it just halts Flash and replaces the plugin window with a circled exclamation point.

Because it doesn't crash a browser anymore, the ByteArray method is no longer useful for protecting against mm.cfg bootstrapping or runtime decompilers. The Vector method is still useful in some narrow circumstances, understanding that mm.cfg defined preloaders will be looking for an allComplete event, and you need to halt execution before that (i.e. with a direct call from the main constructor).

Luckily, there is a new guaranteed way to crash Flash 11,2, which is to run it in Chrome under Ubuntu and just paste rich text into an input textfield :P