We used to need to silence float-divide-by-zero and float-cast-overflow
sanitizers since clang used a finite valid floating point value range.
Fortunately, since clang-9 UBSAN properly handles various primitive
operations per IEEE-754 so we no longer need this workaround.
Also use fork=16 mode for fuzz targets to make it easier to run fuzzing
locally.
strcat does not allow overlapping ranges; we didn't have a test for this
but now we do.
As an added bonus, this also means we only compute the length of each
fragment once now.
This allows us to fix the quadratic complexity of parse_merge_pcdata.
After parsing the first PCDATA we need to advance by its length; we
still compute the length of each fragment twice with this approach, but
it's constant time.
strconcat in the parsing loop only works if we know the source string
comes from the same buffer that we're parsing. This is somewhat
cumbersome to establish during parsing and it requires extra tracking
data, so we just disable this combination as it's unlikely to be
actually useful - usually append_buffer would be called on a possibly
empty collection of elements, not on something with PCDATA.
Add tests for double escape and a test for interaction with
parse_ws_pcdata flags; this behavior might change but we should pin the
current result.
Also slightly clean up the previously added test.
Here we also test what happens when text gets assigned to an empty
string after initially being non-empty, to make sure this is not
different from the initial state.
We use a special number formatting routine to generate the XPath
REC-compliant number representation; it relies on being able to get a
decimal representation of the source number, which we use sprintf for as
a fallback.
This is fairly insensitive to current locale, except for an assertion
that validates the decimal point as a precaution, and this check
triggers when the locale decimal point is not a dot.
Ideally we'd use a locale-insensitive routine here. On some systems we
have ecvt_r (similarly to MSVC's ecvt_s), but it's deprecated so
adopting it might be fraught with peril.
For now let's simply adjust the assertion to account for locales with
comma as a separator. This is probably not fully comprehensive but
probably gets us from a 90% solution to a 99% solution...
Fixes#574.
With CMake 3.27, we get a deprecation warning:
"Compatibility with CMake < 3.5 will be removed from a future version of CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions."
Bump min version to 3.5 to remove warning.