Skip to content

PR 4286 causes segfault - please revert #4289

@ja11sop

Description

@ja11sop

Recent PR #4286 causes segfault.

The following code:

std::ostringstream Stream;
std::string Line = "";
Stream << fmt::format( "{}", fmt::styled( Line, fmt::fg( fmt::terminal_color::blue ) ) ) << "\n";

segfaults with backtrace:

#0  0x000055555568bbf3 in fmt::v11::detail::buffer<char>::append<char> (this=0x0, begin=begin@entry=0x7fffffffb400 "\033[34m", end=end@entry=0x7fffffffb405 "")
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:1797
#1  0x00005555556a69e3 in fmt::v11::detail::copy<char, char const*, fmt::v11::basic_appender<char>, 0> (begin=0x7fffffffb400 "\033[34m", end=0x7fffffffb405 "", out=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:2008
#2  0x00005555556984d2 in fmt::v11::formatter<fmt::v11::detail::styled_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, void>::format<fmt::v11::context> (
    this=0x7fffffffb480, arg=..., ctx=...) at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/color.h:574
#3  0x000055555568bcf1 in fmt::v11::detail::value<fmt::v11::context>::format_custom<fmt::v11::detail::styled_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, fmt::v11::formatter<fmt::v11::detail::styled_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, void> > (arg=0x7fffffffbaf0, parse_ctx=..., ctx=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:2240
#4  0x000055555570f6af in fmt::v11::basic_format_arg<fmt::v11::context>::handle::format (this=<optimized out>, parse_ctx=..., ctx=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:2444
#5  0x000055555570d9bd in fmt::v11::detail::default_arg_formatter<char>::operator() (this=0x7fffffffb608, h=...) at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/format.h:3488
#6  0x000055555570c767 in fmt::v11::basic_format_arg<fmt::v11::context>::visit<fmt::v11::detail::default_arg_formatter<char> > (this=this@entry=0x7fffffffb5c0, vis=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:2484
#7  0x000055555570a4b3 in fmt::v11::detail::vformat_to (buf=..., fmt=..., args=..., loc=...) at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/format-inl.h:1454
#8  0x000055555570a387 in fmt::v11::vformat[abi:cxx11](fmt::v11::basic_string_view<char>, fmt::v11::basic_format_args<fmt::v11::context>) (fmt=..., args=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/format-inl.h:1444
#9  0x000055555568269d in fmt::v11::format<fmt::v11::detail::styled_arg<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > (fmt=...)
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/format.h:4186

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