In bug 250702, various mangled identifiers are reported which cause
libelftc's demangler (in libelftc_dem_gnu3.c) to abort, with a few
different assertion failures. I have submitted fixes upstream, but in
the mean time we want to apply these to our copy:
Fix 1: Work around problem introduced in upstream r3531:
Ensure cpp_demangle_read_sname() checks ddata->cur_output, since it
can be called with ddata->cur_output set to many different `struct
vector_str` instances.
Fix 2: Fix the second part of #581, which is about an assertion with
nested template parameters.
demangle:
_ZZN7WebCore19SVGAnimatedProperty20LookupOrCreateHelperINS_32SVGAnimatedStaticPropertyTearOffIbEEbLb1EE21lookupOrCreateWrapperEPNS_10SVGElementEPKNS_15SVGPropertyInfoERbE19__PRETTY_FUNCTION__
to:
WebCore::SVGAnimatedProperty::LookupOrCreateHelper<WebCore::SVGAnimatedStaticPropertyTearOff<bool>, bool, true>::lookupOrCreateWrapper(WebCore::SVGElement*, WebCore::SVGPropertyInfo const*, bool&)::__PRETTY_FUNCTION__
Fix 3: Fix assertions in home-grown vector implementation.
When vector_str_push_vector() pushes a vector of size 1 onto a vector
of size 0, as is usual in the beginning of demangling, the resulting
vector gets a capacity of 1. Later on, this wreaks havoc when its
capacity is multiplied by BUFFER_GROW_FACTOR (1.618), since this
rounds down so the capacity cannot grow beyond 1!
Add a BUFFER_GROW() macro to ensure the calculation is correctly
rounded, and always increases the capacity.