From: Mikael Magnusson <mikachu@gmail.com>
To: Leon Weber <leon@leonweber.de>
Cc: zsh-workers@zsh.org
Subject: Re: Integer overflow during brace expansion
Date: Mon, 27 Feb 2012 18:01:23 +0100 [thread overview]
Message-ID: <CAHYJk3TtwY7eUXRrB9DfoAva+LUoFTnyi4wVNBqR2WvB7NG=PQ@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3Skfz7xQcGv=r5t+-MQ_YCv0CGsmhK3k-9GnCwuV09-Uw@mail.gmail.com>
On 27 February 2012 17:54, Mikael Magnusson <mikachu@gmail.com> 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
next prev parent reply other threads:[~2012-02-27 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 16:22 Leon Weber
2012-02-27 16:52 ` Mikael Magnusson
2012-02-27 16:54 ` Mikael Magnusson
2012-02-27 17:01 ` Mikael Magnusson [this message]
2012-02-27 17:35 ` Peter Stephenson
2012-03-01 14:30 ` Peter Stephenson
2012-03-01 16:20 ` Wayne Davison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHYJk3TtwY7eUXRrB9DfoAva+LUoFTnyi4wVNBqR2WvB7NG=PQ@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=leon@leonweber.de \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).