apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Shahaf <...@daniel.shahaf.name>
Subject [PATCH] APR_EXPAND_VAR: detect infinite loops
Date Sun, 19 Feb 2012 23:57:40 GMT
[[[
Index: build/apr_common.m4
===================================================================
--- build/apr_common.m4	(revision 1291093)
+++ build/apr_common.m4	(working copy)
@@ -696,11 +696,17 @@
 AC_DEFUN([APR_EXPAND_VAR], [
 ap_last=
 ap_cur="$2"
-while test "x${ap_cur}" != "x${ap_last}";
+ap_expand_iters=0
+while test "x${ap_cur}" != "x${ap_last}" && test x$ap_expand_iters != x500;
 do
   ap_last="${ap_cur}"
   ap_cur=`eval "echo ${ap_cur}"`
+  ap_expand_iters=`expr 1 + $ap_expand_iters`
 done
+if test x$ap_expand_iters = x500
+then
+  AC_MSG_ERROR([APR_EXPAND_VAR($1,$2): infinite loop])
+fi
 $1="${ap_cur}"
 ])
 
]]]

I ran into this doing
% ./configure --prefix=\$prefix
with one backslash too many.

Not tested.

Mime
View raw message