public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug stdio/30441] snprintf truncates output on extremely large buffer sizes
Date: Thu, 11 May 2023 21:46:41 +0000	[thread overview]
Message-ID: <bug-30441-131-sPLqq0TwrM@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30441-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30441

--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> ---
PS: The bug appears to be caused by the fact that glibc internally tries to
compute a pointer to the end of the provided buffer, which results in a pretty
much guaranteed overflow given the provided value. This in turn ends up making
a later if statement of: `if (buf->base.write_ptr < buf->base.write_end)` fail,
where that if statement seems to have been meant to check for the case where
less characters than the buffer can contain have been written (which is the
case here, but the if statement thinks this is not the case because of the
pointer arithmetic overflow).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2023-05-11 21:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 21:41 [Bug stdio/30441] New: " gabravier at gmail dot com
2023-05-11 21:46 ` gabravier at gmail dot com [this message]
2023-05-12  0:09 ` [Bug stdio/30441] " michael.hudson at canonical dot com
2023-05-12  0:45 ` gabravier at gmail dot com
2023-05-14 21:29 ` michael.hudson at canonical dot com
2023-06-06 21:50 ` gabravier at gmail dot com
2023-06-07  1:53 ` gabravier at gmail dot com
2023-06-07  8:39 ` sam at gentoo dot org
2023-06-07 23:09 ` joseph at codesourcery dot com
2023-07-25 21:59 ` nbowler at draconx dot ca
2024-01-17  9:32 ` schwab@linux-m68k.org
2024-01-17 19:47 ` i at maskray dot me

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=bug-30441-131-sPLqq0TwrM@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).