Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • Moritz Bunkus
  • MKVToolNixMKVToolNix
  • Issues
  • #3548

Invalid format string for fmt::format

Running mkvmerge --debug cluster_helper_packets results in terminate called after throwing an instance of 'fmt::v9::format_error' what(): invalid format string.

It's due to unescaped curly braces at merge/cluster_helper.cpp:118.

Similar issue might be also at common/ac3.cpp:384, but I found it by searching the codebase and did not try finding out how to trigger it.

--- a/src/merge/cluster_helper.cpp
+++ b/src/merge/cluster_helper.cpp
@@ -115,8 +115,8 @@ cluster_helper_c::render_before_adding_if_necessary(packet_cptr const &packet) {
   timestamp_delay          = (int64_t)(timestamp_delay / g_timestamp_scale);
 
   mxdebug_if(m->debug_packets,
-             fmt::format("cluster_helper_c::add_packet(): new packet { source {0}/{1} "
-                         "timestamp: {2} duration: {3} bref: {4} fref: {5} assigned_timestamp: {6} timestamp_delay: {7} }\n",
+             fmt::format("cluster_helper_c::add_packet(): new packet {{ source {0}/{1} "
+                         "timestamp: {2} duration: {3} bref: {4} fref: {5} assigned_timestamp: {6} timestamp_delay: {7} }}\n",
                          packet->source->m_ti.m_id, packet->source->m_ti.m_fname, packet->timestamp,          packet->duration,
                          packet->bref,              packet->fref,                 packet->assigned_timestamp, mtx::string::format_timestamp(timestamp_delay)));
--- a/src/common/ac3.cpp
+++ b/src/common/ac3.cpp
@@ -381,7 +381,7 @@ frame_c::to_string(bool verbose)
                             get_effective_channel_layout());
 
   for (auto &frame : m_dependent_frames)
-    output += fmt::format(" { {0} }", frame.to_string(verbose));
+    output += fmt::format(" {{ {0} }}", frame.to_string(verbose));
 
   return output;
 }
Assignee
Assign to
Time tracking