public inbox for liba2i@lists.linux.dev
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: "Alejandro Colomar" <alx@kernel.org>,
	"Paul Eggert" <eggert@cs.ucla.edu>,
	"Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
	"Eli Schwartz" <eschwartz93@gmail.com>,
	"Sam James" <sam@gentoo.org>, "Serge Hallyn" <serge@hallyn.com>,
	"Iker Pedrosa" <ipedrosa@redhat.com>,
	"Andrew J. Hesford" <ajh@sideband.org>,
	"Michael Vetter" <jubalh@iodoru.org>,
	liba2i@lists.linux.dev
Subject: Re: [PATCH v1] xstrtol: 1 is not a valid base
Date: Thu, 18 Jul 2024 20:06:07 +0200	[thread overview]
Message-ID: <2143892.otsE0voPBg@nimes> (raw)
In-Reply-To: <20240718165154.38938-1-alx@kernel.org>

Alejandro Colomar wrote:
> If xstrtol() was being called with a base of 1, under some conditions it
> would invoke Undefined Behavior.

Yes, sure. A numeric base of 1 makes no sense, mathematically.

Thanks for the patch; applied.

Note that I disagree with the statement from
https://github.com/void-linux/void-packages/issues/51261#issuecomment-2237055195 :
> Yet he introduced that bug a decade ago

I wouldn't call it a bug. Gnulib does not document that passing a base of 1
to xstrtol is valid. It's known to everyone in the field that a base of 1
makes no sense. So, what you saw here was a slightly incomplete input
validation check.

Thanks for the improvement.

Bruno




  reply	other threads:[~2024-07-18 18:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 16:52 [PATCH v1] xstrtol: 1 is not a valid base Alejandro Colomar
2024-07-18 18:06 ` Bruno Haible [this message]
2024-07-18 19:53   ` Alejandro Colomar
2024-07-19 16:47     ` Bruno Haible

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=2143892.otsE0voPBg@nimes \
    --to=bruno@clisp.org \
    --cc=ajh@sideband.org \
    --cc=alx@kernel.org \
    --cc=bug-gnulib@gnu.org \
    --cc=congdanhqx@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eschwartz93@gmail.com \
    --cc=ipedrosa@redhat.com \
    --cc=jubalh@iodoru.org \
    --cc=liba2i@lists.linux.dev \
    --cc=sam@gentoo.org \
    --cc=serge@hallyn.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