I tested with the script in attachment, using d=[5|8] r=1, CHDK from autobuild server, camera does not crash. I tested with all options reset to default, P mode. I think that crash depends on some camera menu setting value, but to detect the cause, more tests are required.