Project

General

Profile

Bug #11466 » patch-dynamic-pcre-recursion-limit.diff

Lower PCRE recursion limit based on stack size (doesn't prevent the crash -- but may aid in debugging) - Jim Pingle, 06/03/2021 09:15 AM

View differences:

src/etc/rc.php_ini_setup
fi
fi
PCRE_RECURSION_LIMIT=100000
STACKSIZE=$(/usr/bin/ulimit -s)
if [ ${STACKSIZE} -gt 32000 -a ${STACKSIZE} -le 64000 ]; then
PCRE_RECURSION_LIMIT=64000
elif [ ${STACKSIZE} -gt 16000 -a ${STACKSIZE} -le 32000 ]; then
PCRE_RECURSION_LIMIT=32000
elif [ ${STACKSIZE} -gt 8000 -a ${STACKSIZE} -le 16000 ]; then
PCRE_RECURSION_LIMIT=16000
elif [ ${STACKSIZE} -gt 4000 -a ${STACKSIZE} -le 8000 ]; then
PCRE_RECURSION_LIMIT=8000
elif [ ${STACKSIZE} -le 4000 ]; then
PCRE_RECURSION_LIMIT=500
fi
# Set upload directory
UPLOADTMPDIR="/tmp"
......
session.hash_function = 1
${error_reporting}
[Pcre]
pcre.recursion_limit = ${PCRE_RECURSION_LIMIT}
; Extensions
EOF
(2-2/3)