Skip to content

Commanline arg parser segfault #1533

Description

@arvedarved

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions