[PATCH] Ensure std::getline always 0-terminates string.
Volodymyr Sapsai via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 20 13:19:04 PST 2017
On Nov 20, 2017, at 11:32, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
>
> On Mon, Nov 20, 2017 at 11:02:13AM -0800, Volodymyr Sapsai wrote:
>>> catch (...)
>>> {
>>> + if (__n > 0)
>>> + *__s = char_type();
>>> this->__set_badbit_and_consider_rethrow();
>>> }
>>
>> or maybe something else?
>
> That one (note that the __set_badbit_and_consider_rethrow
> will never re-throw in this case).
But by #define _LIBCPP_NO_EXCEPTIONS 1 you exclude this block at preprocessing step
> #ifndef _LIBCPP_NO_EXCEPTIONS
> }
> catch (...)
> {
> + if (__n > 0)
> + *__s = char_type();
> this->__set_badbit_and_consider_rethrow();
> }
> #endif // _LIBCPP_NO_EXCEPTIONS
And looks like getline_pointer_size_exception.pass.cpp doesn’t execute this code.
More information about the cfe-commits
mailing list