Re: [PATCH] libstdc++: Avoid overflow in bounds checks [PR103955]

2022-01-11 Thread Jonathan Wakely via Gcc-patches
On Tue, 11 Jan 2022 at 20:03, Patrick Palka via Libstdc++ < libstd...@gcc.gnu.org> wrote: > We currently crash when the floating-point to_chars overloads are passed > a precision value near INT_MAX, ultimately due to overflow in the bounds > checks that verify the output range is large enough. > >

[PATCH] libstdc++: Avoid overflow in bounds checks [PR103955]

2022-01-11 Thread Patrick Palka via Gcc-patches
We currently crash when the floating-point to_chars overloads are passed a precision value near INT_MAX, ultimately due to overflow in the bounds checks that verify the output range is large enough. The most portable fix seems to be to replace bounds checks of the form A >= B + C (where B + C may