From: Tom Tromey <tom@tromey.com>
To: Kirill Radkin <kirill.radkin@syntacore.com>
Cc: <tom@tromey.com>, <gdb-patches@sourceware.org>,
<anatoly.parshintsev@syntacore.com>,
<ivan.tetyushkin@syntacore.com>,
<konstantin.vladimirov@syntacore.com>
Subject: Re: [PATCH] gdbserver: Fix overflow detection in gdbserver
Date: Thu, 08 Feb 2024 09:19:49 -0700 [thread overview]
Message-ID: <87plx79bdm.fsf@tromey.com> (raw)
In-Reply-To: <20240110145746.57459-1-kirill.radkin@syntacore.com> (Kirill Radkin's message of "Wed, 10 Jan 2024 17:57:46 +0300")
>>>>> "Kirill" == Kirill Radkin <kirill.radkin@syntacore.com> writes:
Thank you for the patch.
I didn't see a reply to this one.
Kirill> +template <typename T>
Kirill> static int
Kirill> -require_int (char **pp, int *value)
Kirill> +require_int (char **pp, T *value)
Kirill> {
Kirill> + constexpr bool is_signed = std::is_signed<T>::value;
Kirill> + if (!is_signed)
Kirill> + return -1;
I don't understand this early return.
If using an unsigned type here is intended to be invalid, then I think
that should be enforced at compile time.
Kirill> - if (count >= 8 || (count == 7 && firstdigit >= 0x8))
Kirill> + if (count >= max_count || (count == (max_count - 1)
Kirill> + && firstdigit >= 0x8))
Kirill> return -1;
However, it seems pretty simple to handle unsigned here as well.
thanks,
Tom
next prev parent reply other threads:[~2024-02-08 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 8:38 [PATCH] [gdbserver] " Kirill Radkin
2023-12-21 19:42 ` Simon Marchi
2023-12-22 15:41 ` Tom Tromey
2024-01-10 14:57 ` [PATCH] gdbserver: " Kirill Radkin
2024-02-08 16:19 ` Tom Tromey [this message]
2024-02-19 14:19 ` [PATCH v2] " Kirill Radkin
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=87plx79bdm.fsf@tromey.com \
--to=tom@tromey.com \
--cc=anatoly.parshintsev@syntacore.com \
--cc=gdb-patches@sourceware.org \
--cc=ivan.tetyushkin@syntacore.com \
--cc=kirill.radkin@syntacore.com \
--cc=konstantin.vladimirov@syntacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).