Subject: Re: bug#42931: 27.1; json-pretty-print-buffer on ~2MB line causes core dump
From: Paul Eggert <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
Date: Tue, 25 Aug 2020 11:19:04 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 8/24/20 11:12 PM, Eli Zaretskii wrote:
> What about "normal" Emacs builds?  They usually have between 2MB and
> 8MB of stack.  Should we worry about stack overflow in these cases?

No. On x86-64 Ubuntu 18.04.5 each recursion level consumes 304 bytes. Dividing 2 
MB by 304 gives you 6578 stack frames, which means the algorithm could handle a 
vector of 2**6578 entries, which can't exist anywhere in the known physical 
universe.

On real machines it'd have to be reeeeally tiny stack for this recursion to be a 
significant problem now, so tiny that Emacs would crash for countless other 
reasons. I'll take the liberty of closing the bug report.