Skip to content

Commit 6d34a1c

Browse files
committed
rtp/video_decoders: Fix unitialized string use
If log level was > NOTICE, then desc was never written, but passed to control_report_stats(). Introduced in 12dbbce Also reduce the buf size as using 8KB of stack just to print a video format is ridiculously inefficient
1 parent 6a1eaa1 commit 6d34a1c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/rtp/video_decoders.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,13 +1499,13 @@ static void check_for_mode_change(struct state_video_decoder *decoder,
14991499
PARAM_TILE_COUNT)) {
15001500
return;
15011501
}
1502-
char desc[STR_LEN];
1503-
MSG(NOTICE, "New incoming video format detected: %s\n",
1504-
video_desc_to_string(network_desc, sizeof desc, desc));
1502+
char desc[256] = "";
1503+
video_desc_to_string(network_desc, sizeof(desc), desc);
1504+
MSG(NOTICE, "New incoming video format detected: %s\n", desc);
15051505

1506-
char report[STR_LEN];
1507-
snprintf_ch(report, "new incoming video fmt: %s", desc);
1508-
control_report_stats(decoder->control, report);
1506+
std::string report = "new incoming video fmt: ";
1507+
report += desc;
1508+
control_report_stats(decoder->control, report.c_str());
15091509

15101510
reconfigure_helper(decoder, network_desc, {});
15111511
}

0 commit comments

Comments
 (0)