All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Sami Kerola <kerolasa@iki.fi>, util-linux@vger.kernel.org
Subject: Re: [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer]
Date: Wed, 03 Dec 2014 23:53:09 +0000	[thread overview]
Message-ID: <547FA265.6040806@draigBrady.com> (raw)
In-Reply-To: <1417355862-16935-2-git-send-email-kerolasa@iki.fi>

On 30/11/14 13:57, Sami Kerola wrote:
> This error was reported 155 times.
> 
> lib/mbsalign.c:322:18: runtime error: unsigned integer overflow: 0 - 1
> cannot be represented in type 'size_t' (aka 'unsigned long')
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  lib/mbsalign.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/mbsalign.c b/lib/mbsalign.c
> index b307d19..052fec6 100644
> --- a/lib/mbsalign.c
> +++ b/lib/mbsalign.c
> @@ -319,7 +319,7 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
>  {
>    /* FIXME: Should we pad with "figure space" (\u2007)
>       if non ascii data present?  */
> -  while (n_spaces-- && (dest < dest_end))
> +  for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
>      *dest++ = ' ';
>    *dest = '\0';
>    return dest;
> 

What compiler and version are you using for this?
I don't get the error with gcc 4.9.2 with -fsanitize=undefined
Note the error is incorrect I think as the variable is not read
after the overflow.

thanks,
Pádraig.

  reply	other threads:[~2014-12-04 23:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-30 13:57 [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
2014-11-30 13:57 ` [PATCH 01/10] lib/mbalign: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-12-03 23:53   ` Pádraig Brady [this message]
2014-12-04 20:14     ` Sami Kerola
2014-12-07 11:56       ` Pádraig Brady
2014-12-08 11:00         ` Karel Zak
2014-12-04 11:51   ` Pádraig Brady
2014-11-30 13:57 ` [PATCH 02/10] cal: fix signed " Sami Kerola
2014-12-08 11:07   ` Karel Zak
2014-11-30 13:57 ` [PATCH 03/10] more: fix unsigned " Sami Kerola
2014-12-08 11:42   ` Karel Zak
2014-12-08 12:56     ` Sami Kerola
2014-12-19  9:20       ` Sami Kerola
2014-11-30 13:57 ` [PATCH 04/10] lib: fix crc32 and crc64 interger overflows [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 05/10] fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 06/10] strutils: fix unsigned integer overflows [AddressSanitizer] Sami Kerola
2014-11-30 13:57 ` [PATCH 07/10] mkfs.cramfs: fix unsigned integer overflow [AddressSanitizer] Sami Kerola
2014-12-08 11:37   ` Karel Zak
2014-12-19  9:24     ` Sami Kerola
2014-11-30 13:57 ` [PATCH 08/10] include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute Sami Kerola
2014-11-30 16:42   ` Benno Schulenberg
2014-12-19  9:50     ` Sami Kerola
2014-11-30 13:57 ` [PATCH 09/10] lscpu: blacklist vmware_bdoor() AddressSanitizer check Sami Kerola
2014-11-30 16:34   ` Benno Schulenberg
2014-11-30 17:17     ` Sami Kerola
2014-11-30 17:27     ` Drake Wilson
2014-11-30 13:57 ` [PATCH 10/10] ipcs: fix two data type errors [AddressSanitizer] Sami Kerola
2014-12-08 12:21   ` Karel Zak
2014-12-19  9:26     ` Sami Kerola
2014-11-30 14:03 ` [PATCH 00/10] pull: AddressSanitizer round II Sami Kerola
2014-12-15  9:15 ` Karel Zak
2014-12-15 10:38   ` Sami Kerola
2014-12-19  9:52     ` Sami Kerola
2014-12-19 13:23 ` Karel Zak

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=547FA265.6040806@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.