From: Herbert Xu <herbert@gondor.apana.org.au>
To: Tiago de Paula <tiagodepalves@gmail.com>
Cc: dash@vger.kernel.org, tiagodepalves@gmail.com
Subject: Re: [PATCH] input: Fix heap-buffer-overflow in preadbuffer on long lines
Date: Sat, 14 Mar 2026 18:23:37 +0900 [thread overview]
Message-ID: <abUpGUbMsSSM8mEF@gondor.apana.org.au> (raw)
In-Reply-To: <CAO_NRt5mv7E-qkSA2hE+4HsQMzpczrF9ZAWL-jKbW0Li1F3U0A@mail.gmail.com>
Tiago de Paula <tiagodepalves@gmail.com> wrote:
> Update lleft before calling preadfd so buffered data is preserved
> when refilling the buffer during long line scanning, preventing
> out-of-bounds reads.
>
> Fixes: a065467315dc ("input: Move newline loop into preadbuffer")
> Signed-off-by: Tiago de Paula <tiagodepalves@gmail.com>
> ---
> I discovered this via perlbrew: config.sh contained a single
> 'cppsymbols=...' line that was 12502 characters long. The issue
> can be replicated with:
>
> python -c 'print("VAR=" + "a"*8300)' > repro.sh
> dash repro.sh
>
> AddressSanitizer reports a heap-buffer-overflow in preadbuffer(),
> which led to me this fix.
>
> src/input.c | 1 +
> 1 file changed, 1 insertion(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2026-03-14 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 7:29 [PATCH] input: Fix heap-buffer-overflow in preadbuffer on long lines Tiago de Paula
2026-03-14 9:23 ` Herbert Xu [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=abUpGUbMsSSM8mEF@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dash@vger.kernel.org \
--cc=tiagodepalves@gmail.com \
/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