Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
On Thu, 4 Apr 2024 at 17:55, Jonathan Wakely wrote: > > On Thu, 4 Apr 2024 at 17:30, Jonathan Wakely wrote: > Ulrich's suggestion is to allow the buggy user code to Just Work (for > all cases except (char)-1 on a platform where char is signed). That is > maybe the least surprising behaviour for

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
On Thu, 4 Apr 2024 at 17:30, Jonathan Wakely wrote: > > On Thu, 4 Apr 2024 at 16:40, Iain Sandoe wrote: > > > > > > > > > On 4 Apr 2024, at 16:29, Jonathan Wakely wrote: > > > > > > I would appreciate more eyes on this to confirm my conclusions about > > > negative int_type values, and the

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
On Thu, 4 Apr 2024 at 17:33, Jonathan Wakely wrote: > > On Thu, 4 Apr 2024 at 17:29, Ulrich Drepper wrote: > > > > On Thu, Apr 4, 2024 at 5:29 PM Jonathan Wakely wrote: > > > I would appreciate more eyes on this to confirm my conclusions about > > > negative int_type values, and the proposed

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
On Thu, 4 Apr 2024 at 17:29, Ulrich Drepper wrote: > > On Thu, Apr 4, 2024 at 5:29 PM Jonathan Wakely wrote: > > I would appreciate more eyes on this to confirm my conclusions about > > negative int_type values, and the proposed fix, make sense. > > The way something like this is handled in

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
On Thu, 4 Apr 2024 at 16:40, Iain Sandoe wrote: > > > > > On 4 Apr 2024, at 16:29, Jonathan Wakely wrote: > > > > I would appreciate more eyes on this to confirm my conclusions about > > negative int_type values, and the proposed fix, make sense. > > > > Tested x86_64-linux. > > > > -- >8 -- > >

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Ulrich Drepper
On Thu, Apr 4, 2024 at 5:29 PM Jonathan Wakely wrote: > I would appreciate more eyes on this to confirm my conclusions about > negative int_type values, and the proposed fix, make sense. The way something like this is handled in glibc's ctype functions is that both branches are considered. For

Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Iain Sandoe
> On 4 Apr 2024, at 16:29, Jonathan Wakely wrote: > > I would appreciate more eyes on this to confirm my conclusions about > negative int_type values, and the proposed fix, make sense. > > Tested x86_64-linux. > > -- >8 -- > > A negative value for the delim value passed to

[PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

2024-04-04 Thread Jonathan Wakely
I would appreciate more eyes on this to confirm my conclusions about negative int_type values, and the proposed fix, make sense. Tested x86_64-linux. -- >8 -- A negative value for the delim value passed to std::istream::ignore can never match any character in the stream, because the comparison