From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7712 invoked by alias); 27 Feb 2012 17:01:28 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30282 Received: (qmail 2009 invoked from network); 27 Feb 2012 17:01:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.171 as permitted sender) Received-SPF: pass (google.com: domain of mikachu@gmail.com designates 10.60.3.167 as permitted sender) client-ip=10.60.3.167; Authentication-Results: mr.google.com; spf=pass (google.com: domain of mikachu@gmail.com designates 10.60.3.167 as permitted sender) smtp.mail=mikachu@gmail.com; dkim=pass header.i=mikachu@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Av2akGH1EpcdwNCNfOBEla5+VrmllyTSRuLEaCsOASY=; b=AoLLVEFrGPcm76UL1k86gjuxnqyUHsWignRkSfS7me8IH2X37Jt+yDkvGCuGWDFm5F Lggl3xIyot4mi0BCpIU68Z5wNRNwebpjXgDPaxxY11Mm3KRnIq7vloZiYR7hkSsGP6xX HqTBsJxMbyCWXlgtR8gpEvTEr2ETrDlwMEU6I= MIME-Version: 1.0 In-Reply-To: References: <20120227162251.GA17559@zaphod.q-ix.net> Date: Mon, 27 Feb 2012 18:01:23 +0100 Message-ID: Subject: Re: Integer overflow during brace expansion From: Mikael Magnusson To: Leon Weber Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 27 February 2012 17:54, Mikael Magnusson wrote: >> >> The fix is fairly simple, just change the types involved to zlong. A >> problem is that sprintf is used to convert the generated numbers back >> to a string, and zlong can be an int or a long, but I forgot if we >> have a modifier macro that expands to the correct thing. I remember >> asking about it before (and possibly saying I would look in to fixing >> it), but at the moment I don't remember what the result was. I found the old thread now, pws suggested just using %ld and casting the value to long, to which I replied something incomprehensibly stupid, "but %d won't work if I cast to long". If nobody sees a problem with the above patch, I can commit it with this change. - sprintf(p + strp, "%0*ld", minw, rend); + sprintf(p + strp, "%0*ld", minw, (long)rend); -- Mikael Magnusson