From: Dmitry Verenitsin Date: Tue, 26 May 2026 19:27:05 +0000 (+0500) Subject: Merge commit from fork X-Git-Tag: v1.11.1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02ac36bb11975f4382fdb566ccf3dad21986a6ef;p=thirdparty%2Ffreeswitch.git Merge commit from fork Lower `CJSON_NESTING_LIMIT` from upstream default 1000 to 64 via `SWITCH_AM_CFLAGS` / `SWITCH_AM_CXXFLAGS`. The mutually recursive `parse_value`/`parse_array`/`parse_object` chain in cJSON consumes ~2 stack frames per nesting level, which can overflow worker threads running on `SWITCH_THREAD_STACKSIZE` (240 KB). --- diff --git a/configure.ac b/configure.ac index a9bc51a1a9..bf6421e4e7 100644 --- a/configure.ac +++ b/configure.ac @@ -308,6 +308,11 @@ SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/incl SWITCH_AM_CPPFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src" SWITCH_AM_LDFLAGS="-lm" +# Cap cJSON parser recursion depth. Default upstream limit (1000) can overflow +# small thread stacks; both vendored cJSON copies (src/ and libs/esl/) honor this. +APR_ADDTO(SWITCH_AM_CFLAGS, [-DCJSON_NESTING_LIMIT=64]) +APR_ADDTO(SWITCH_AM_CXXFLAGS, [-DCJSON_NESTING_LIMIT=64]) + #set SOLINK variable based on compiler and host if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then SOLINK="-Bdynamic -dy -G"