This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] PR libstdc++/70664 Set failbit and read zero on stream reading negative value into unsigned type
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jean-Baptiste Daval <naarakah at crans dot org>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 13 Mar 2018 16:45:42 +0000
- Subject: Re: [PATCH] PR libstdc++/70664 Set failbit and read zero on stream reading negative value into unsigned type
- Authentication-results: sourceware.org; auth=none
- References: <ea451cae-782b-69ee-cff4-26b761f451fd@crans.org>
On 13 March 2018 at 15:55, Jean-Baptiste Daval wrote:
> Hi,
>
> Currently when a value is extracted from a stream into a unsigned type,
> there is no test to check if the value is negative, in which case there
> is an overflow and failbit is not set (the correct behavior would be to
> read a zero and set failbit). This patch add a condition to check when
> we are in this particular case, read a zero and set failbit accordingly.
Thank you for the patch. It looks small enough that we don't need a
copyright assignment. The GCC trunk is currently only open for
regression fixes (and we also allow changes to C++17 library features
while our C++17 support is considered experimental). As soon as the
trunk re-opens for normal changes I'll apply your patch. For now I've
updated the bug report with a link to your patch, so we won't forget
about it.