Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some old STL implementation of regex have BUGs and will crash. #2463

Closed
owent opened this issue Dec 20, 2023 · 3 comments · Fixed by #2464
Closed

Some old STL implementation of regex have BUGs and will crash. #2463

owent opened this issue Dec 20, 2023 · 3 comments · Fixed by #2464
Assignees
Labels
bug Something isn't working

Comments

@owent
Copy link
Member

owent commented Dec 20, 2023

Is your feature request related to a problem?
Some old STL implementation of regex have BUGs and will crash.

Describe the solution you'd like
Avoid to use these regex features.

Additional context

(gdb) bt
#0  0x00007ffff67f1387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007ffff67f2a78 in __GI_abort () at abort.c:90
#2  0x00007ffff6eeba95 in __gnu_cxx::__verbose_terminate_handler () at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff6ee9a06 in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
#4  0x00007ffff6ee9a33 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff6ee9c53 in __cxxabiv1::__cxa_throw (obj=0x657bf80, tinfo=0x7ffff717a890 <typeinfo for std::regex_error>, dest=0x7ffff6f3fd30 <std::regex_error::~regex_error()>) at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:87
#6  0x00007ffff6f3f095 in std::__throw_regex_error (__ecode=__ecode@entry=std::regex_constants::_S_error_brack) at ../../../../../libstdc++-v3/src/c++11/functexcept.cc:118
#7  0x0000000001d32d56 in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_M_bracket_expression (this=this@entry=0x7fffffffd530) at /usr/include/c++/4.8.2/bits/regex_compiler.h:974
#8  0x0000000001d32f47 in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_M_atom (this=this@entry=0x7fffffffd530) at /usr/include/c++/4.8.2/bits/regex_compiler.h:960
#9  0x0000000001d3347a in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_M_term (this=this@entry=0x7fffffffd530) at /usr/include/c++/4.8.2/bits/regex_compiler.h:795
#10 0x0000000001d3351e in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_M_alternative (this=this@entry=0x7fffffffd530) at /usr/include/c++/4.8.2/bits/regex_compiler.h:773
#11 0x0000000001d33694 in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_M_disjunction (this=0x7fffffffd530) at /usr/include/c++/4.8.2/bits/regex_compiler.h:758
#12 0x0000000001d339bb in std::__detail::_Compiler<char const*, std::regex_traits<char> >::_Compiler (this=0x7fffffffd530, __b=<optimized out>, __e=<optimized out>, __traits=..., __flags=<optimized out>)
    at /usr/include/c++/4.8.2/bits/regex_compiler.h:729
#13 0x0000000001d33c53 in std::__detail::__compile<char const*, std::regex_traits<char> > (__b=@0x7fffffffd648: 0x29b43d7 "[^a-zA-Z0-9]", __e=@0x7fffffffd658: 0x29b43e3 "", __t=..., __f=__f@entry=16)
    at /usr/include/c++/4.8.2/bits/regex_compiler.h:1105
#14 0x0000000001d34011 in std::basic_regex<char, std::regex_traits<char> >::basic_regex (this=0x4d07ea0 <opentelemetry::v1::exporter::metrics::INVALID_CHARACTERS_PATTERN>, __p=0x29b43d7 "[^a-zA-Z0-9]", __f=<optimized out>)
    at /usr/include/c++/4.8.2/bits/regex.h:388
#15 0x0000000000e7ec53 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
    at /data/devops/workspace/p-4943d876cb734a609b55ad5c740c36ff/src/server/main/third_party/packages/opentelemetry-cpp-v1.13.0/exporters/prometheus/src/exporter_utils.cc:280
#16 _GLOBAL__sub_I_exporter_utils.cc(void) () at /data/devops/workspace/p-4943d876cb734a609b55ad5c740c36ff/src/server/main/third_party/packages/opentelemetry-cpp-v1.13.0/exporters/prometheus/src/exporter_utils.cc:735
#17 0x000000000298c58d in __libc_csu_init ()
#18 0x00007ffff67dd4e5 in __libc_start_main (main=0xe75540 <main(int, char**)>, argc=10, argv=0x7fffffffd888, init=0x298c540 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd878)
    at ../csu/libc-start.c:225
#19 0x0000000000e94c87 in _start ()
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 20, 2023
@owent owent self-assigned this Dec 20, 2023
@marcalff
Copy link
Member

@owent

STL regex are known to be broken in gcc 4.8 and 4.9

// Regex support
#if (__GNUC__ == 4 && (__GNUC_MINOR__ == 8 || __GNUC_MINOR__ == 9))
#  define OPENTELEMETRY_HAVE_WORKING_REGEX 0
#else
#  define OPENTELEMETRY_HAVE_WORKING_REGEX 1
#endif

Could you confirm which STL version was used, in case other versions also needs to be banned ?

@marcalff
Copy link
Member

Note that the existing test on the gcc version is probably bad, what really needs to be tested is the c++ library version, with __GLIBCXX__

@owent
Copy link
Member Author

owent commented Dec 22, 2023

@owent

STL regex are known to be broken in gcc 4.8 and 4.9

// Regex support
#if (__GNUC__ == 4 && (__GNUC_MINOR__ == 8 || __GNUC_MINOR__ == 9))
#  define OPENTELEMETRY_HAVE_WORKING_REGEX 0
#else
#  define OPENTELEMETRY_HAVE_WORKING_REGEX 1
#endif

Could you confirm which STL version was used, in case other versions also needs to be banned ?

This crash is under GCC 4.8.
Do you think we can use the #2464 when OPENTELEMETRY_HAVE_WORKING_REGEX==0 and still use the regex implementation when OPENTELEMETRY_HAVE_WORKING_REGEX==1?

@marcalff marcalff added bug Something isn't working and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants