[Github-comments] [geany/geany] Segmentation Fault when opening JSON file with terminal colors (Linux) (#1768)

elextr notifications at xxxxx
Sun Feb 11 01:49:32 UTC 2018


There is no way to prevent a recursive program from running out of stack if its given pathological input like this unless you wish to make some arbitrary limit on nesting levels that isn't there in the language (JSON) and may be too small on large systems that have big stacks and may be too big on small systems with small stacks.

@codebrainz if you get Linus and MS and BSD to accept a new API to provide the real stack size (since existing ones return address space not physical limits) and then measure how much stack each iteration takes and divide to get the nesting limit we can prevent overflow.  

Or you can unwind the stack on overflow, recognise its a recursive parser problem and unwind back to where the loop started, terminate the loop and return to Geany now with stack available.  That might "only" take patches to Glibc.

Or you can make the parser non-recursive and control what memory it uses each nesting level so you don't blow heap instead.  Pull requests are welcome :grin:

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1768#issuecomment-364712024
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20180211/bf66f1fb/attachment.html>


More information about the Github-comments mailing list