I tested following strings with invalid surrogate pair and unpaired surrogate in files:
1. `"a\uD800\uD800x"`
2. `"a\uD800x"`
The error messge was: "... invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF; ..."
I think it must be: "... invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; ..."
binary_writer.hpp:869: (style) Consider using std::accumulate algorithm instead of a raw loop.
910a7d2b87/checks (step):5:107
Signed-off-by: Xav83 <x.jouvenot@gmail.com>
binary_reader.hpp:650: (style) Unsigned expression 'mant' can't be negative so it is unnecessary to test it
910a7d2b87/checks (step):5:84
Signed-off-by: Xav83 <x.jouvenot@gmail.com>
For some gcc version (Ubuntu 5.5.0-12ubuntu1~16.04) the existing code
crashes when the minimum value of int64_t is outputted.
Resurrect the code from before 546e2cbf (🚨 fixed some warnings,
2019-03-13) but delegate the sign removal so that the compilers don't
complain about taking the negative value of an unsigned value.
In addition we also rewrite the expression so that we first increment
and then negate.
The definition of remove_sign(number_unsigned_t) is never called as
unsigned values are never negative.
Clang UBSAN currently complains that the char * to input_buffer_adapter
is a nullptr.
Turns out it is actually required to accept nullptr, see for example
line 415 in input_adapters.hpp
...
// the address of first cannot be used: use nullptr
ia = std::make_shared<input_buffer_adapter>(nullptr, len);
....
Therefore we have to handle it gracefully here. We now also ignore the
length parameter l if b is a nullptr.