From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29165 invoked by alias); 2 Dec 2018 00:49:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 29138 invoked by uid 89); 2 Dec 2018 00:49:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_MANYTO,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=H*f:sk:m35zwe4, demangle, crashing, Programs X-HELO: mail-it1-f173.google.com Received: from mail-it1-f173.google.com (HELO mail-it1-f173.google.com) (209.85.166.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 02 Dec 2018 00:49:45 +0000 Received: by mail-it1-f173.google.com with SMTP id i145so4152496ita.4 for ; Sat, 01 Dec 2018 16:49:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ybCvZAvet8YL2QpFqbeZqcgEX9Fgtu8wjGYDpOn94Sc=; b=YfWddyQWwfSuIL3RvMSuKX2i+yeDHMPgGqv4uZ52yHYCmGYmTvl9bGkuIjBuP0ncnW zFSMUDeiYfCcWg9o5voMf7RRGWA3YjUAcAK1K22nHatchTVaKu/JBln6HkxKqszRt23P UeWWNt8+1PijbB3EFOHFY1uPPisHghXSGrtx+M7Szvo1eIn6vzbZrISUkMOLDyhNyc8o BtwvdWxflthPdIPEWniNAoALvH0FbV+J5lqfG17ckJI71FxGlr89v2dhh8B+BhJBW2zN 50yMdIoeaAwjcW2xNgyV74CU4zPGzxgNQOtKYSnRahnAksaCnUS3tEjMnDE/HUA6Qw5H NQXQ== MIME-Version: 1.0 References: <87muprdko7.fsf@redhat.com> <20181130084211.GX12380@tucnak> <173817ca-0aa0-e1a2-6725-37e079ead545@redhat.com> In-Reply-To: From: Cary Coutant Date: Sun, 02 Dec 2018 00:49:00 -0000 Message-ID: Subject: Re: RFA/RFC: Add stack recursion limit to libiberty's demangler To: Nick Clifton , Jakub Jelinek , GCC Patches , Binutils , sgayou@redhat.com, Jason Merrill , Michael Matz Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00027.txt.bz2 > That section is "Writing Robust Programs." Robustness guarantees have > to be different for utilities and servers. A robust server doesn't > crash because of arbitrary user input, but there are servers that > demangle names that are provided by the user. So we need two modes for > the demangler: one that takes anything and sometimes crashes, for > utilities like c++filt, and one that doesn't crash, for servers. And it > seems like that is what Nick is suggesting. In order to handle arbitrary user input without crashing, perhaps the demangler should switch from recursive descent parsing to a state machine, where exhaustion of resources can be handled gracefully. -cary