Index: trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 14439)
+++ trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 15489)
@@ -31,4 +31,6 @@
 		       );
 my $ipprc = PS::IPP::Config->new(); # IPP configuration
+
+my $ITER_LIMIT = 20;
 
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
@@ -281,4 +283,10 @@
 }
 
+# attempt to prevent endless, pathological iterations
+if ($iter >= $ITER_LIMIT) {
+    warn("iteration limit reached -- bailing out");
+    exit($PS_EXIT_PROG_ERROR);
+}
+
 ## add the summary statistics, and request a new iteration if needed
 $command = "$dettool -adddetrunsummary";
