Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Integer overflow during brace expansion
- X-seq: zsh-workers 30282
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Leon Weber <leon@xxxxxxxxxxxx>
- Subject: Re: Integer overflow during brace expansion
- Date: Mon, 27 Feb 2012 18:01:23 +0100
- Authentication-results: mr.google.com; spf=pass (google.com: domain of mikachu@xxxxxxxxx designates 10.60.3.167 as permitted sender) smtp.mail=mikachu@xxxxxxxxx; dkim=pass header.i=mikachu@xxxxxxxxx
- Cc: zsh-workers@xxxxxxx
- 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=
- In-reply-to: <CAHYJk3Skfz7xQcGv=r5t+-MQ_YCv0CGsmhK3k-9GnCwuV09-Uw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20120227162251.GA17559@zaphod.q-ix.net> <CAHYJk3SwmPTq0pNd2qa88kZV0beai9UjsyHeJK0Wh5csgm4=eg@mail.gmail.com> <CAHYJk3Skfz7xQcGv=r5t+-MQ_YCv0CGsmhK3k-9GnCwuV09-Uw@mail.gmail.com>
On 27 February 2012 17:54, Mikael Magnusson <mikachu@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author