zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Peter Stephenson <Peter.Stephenson@csr.com>
Cc: zsh-workers@zsh.org
Subject: Re: Integer overflow during brace expansion
Date: Thu, 1 Mar 2012 08:20:01 -0800	[thread overview]
Message-ID: <CAHSx_Sv5tZDWET8YVqc6DmwAkGhy0EvdnT6AQxhJa_AckZiyvQ@mail.gmail.com> (raw)
In-Reply-To: <20120301143046.49093711@pwslap01u.europe.root.pri>

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Thu, Mar 1, 2012 at 6:30 AM, Peter Stephenson
<Peter.Stephenson@csr.com>wrote:

> +   long long foo = (long long)400;
> +   char buf[20];
> +   sprintf(buf, "before%lldafter", foo);
> +   if (!strcmp(buf, "before400after")) {
>

I think it'd be nice to get some higher bits involved in that check.
 Perhaps something like this:

    long long foo = ((long long)0xdead << 40) | 0xf00d;

compares to before62677660341432333after (and needs a larger buf).

..wayne..

      reply	other threads:[~2012-03-01 16:20 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
2012-02-27 17:35       ` Peter Stephenson
2012-03-01 14:30         ` Peter Stephenson
2012-03-01 16:20           ` Wayne Davison [this message]

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=CAHSx_Sv5tZDWET8YVqc6DmwAkGhy0EvdnT6AQxhJa_AckZiyvQ@mail.gmail.com \
    --to=wayned@users.sourceforge.net \
    --cc=Peter.Stephenson@csr.com \
    --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).