mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
d2381ad6c6
asStringRef removes the first and last characters of a string, enumeration or binary token to drop the delimiters, guarded only by !str.empty(). A malformed single-character token (e.g. a bare '.' left when a fuzzer turns '.PHYSICAL.' into '.)HYSICAL.') has length 1, so the first erase empties the string and the second erase(str.begin()) runs on an empty string. That is undefined behaviour: benign on a normal build, but it aborts (or throws std::length_error from a later append) under a hardened libstdc++ with _GLIBCXX_ASSERTIONS, which is why this file only segfaulted on the Fedora build. Require at least two characters before stripping. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>