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

Commanline arg parser segfault #1533

Closed
arvedarved opened this issue Feb 6, 2019 · 2 comments
Closed

Commanline arg parser segfault #1533

arvedarved opened this issue Feb 6, 2019 · 2 comments

Comments

@arvedarved
Copy link

Describe the bug
If multiple identical commanline arguments are given, catch2 segfaults

Expected behavior
No segfault

Reproduction steps

gdb ../../build/unit_test                             
GNU gdb (Ubuntu 8.2-0ubuntu1) 8.2
[..]
(gdb) run -b -b
Starting program: /build/unit_test -b -b
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000555555718067 in Catch::(anonymous namespace)::PosixColourImpl::setColour (this=, _escapeCode=0x555555915661 "[0;31m") at /usr/include/c++/8/bits/shared_ptr_base.h:1285
1285          get() const noexcept
(gdb) where
#0  0x0000555555718067 in Catch::(anonymous namespace)::PosixColourImpl::setColour (this=, _escapeCode=0x555555915661 "[0;31m")
    at /usr/include/c++/8/bits/shared_ptr_base.h:1285
#1  0x0000555555725b67 in Catch::(anonymous namespace)::PosixColourImpl::use (this=, _colourCode=)
    at 3rdparty/catch2/catch.hpp:8015
#2  0x000055555571dc40 in Catch::Colour::use (_colourCode=Catch::Colour::Red) at 3rdparty/catch2/catch.hpp:8101
#3  0x000055555571dfdc in Catch::Colour::Colour (this=, _colourCode=) at 3rdparty/catch2/catch.hpp:8086
#4  0x000055555574726d in Catch::Session::applyCommandLine (this=0x7fffffffe060, argc=, argv=)
    at 3rdparty/catch2/catch.hpp:10765

[...]

Platform information:

OS: Ubuntu 18.10
Compiler+version: **GCC v8.2.0 **

  • Catch version: v2.6.0
@JoeyGrajciar
Copy link
Contributor

How exactly are you running that gdb? I can not reproduce this on Debian with multiple GCC and Clang compilers.

@laudrup
Copy link
Contributor

laudrup commented Feb 8, 2019

I'm experiencing something similar, which I expect could be related or possibly the same bug by simply using the -l command line option:

Starting program: /tmp/lz4_stream/build/test/lz4_stream_test -l
All available test cases:

Program received signal SIGSEGV, Segmentation fault.
Catch::(anonymous namespace)::PosixColourImpl::setColour (this=0x5555557b7768 <Catch::(anonymous namespace)::PosixColourImpl::instance()::s_instance>, _escapeCode=0x55555574dad3 "[0m")
    at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8039
8039                getCurrentContext().getConfig()->stream()
(gdb) bt
#0  Catch::(anonymous namespace)::PosixColourImpl::setColour (this=0x5555557b7768 <Catch::(anonymous namespace)::PosixColourImpl::instance()::s_instance>, _escapeCode=0x55555574dad3 "[0m")
    at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8039
#1  0x00005555556ae402 in Catch::(anonymous namespace)::PosixColourImpl::use (this=0x5555557b7768 <Catch::(anonymous namespace)::PosixColourImpl::instance()::s_instance>, _colourCode=Catch::Colour::None)
    at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8014
#2  0x00005555556ae9a1 in Catch::Colour::use (_colourCode=Catch::Colour::None) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8101
#3  0x00005555556ae8b2 in Catch::Colour::Colour (this=0x7fffffffd7bf, _colourCode=Catch::Colour::None) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8086
#4  0x00005555556b03a2 in Catch::listTests (config=...) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8915
#5  0x00005555556b17d8 in Catch::list (config=...) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:9025
#6  0x00005555556b8306 in Catch::Session::runInternal (this=0x7fffffffdb80) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:10856
#7  0x00005555556b8137 in Catch::Session::run (this=0x7fffffffdb80) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:10816
#8  0x00005555556ebac5 in Catch::Session::run<char> (this=0x7fffffffdb80, argc=2, argv=0x7fffffffddd8) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:10564
#9  0x00005555556cb2b8 in main (argc=2, argv=0x7fffffffddd8) at /tmp/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:14308

Platform information:

OS: Debian Buster (testing)
Compiler version: GCC v8.2.0
Catch version: v2.6.0

Let me know if I can provide any more information. I can also open a separate issue but this, but it looks very much like the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants