Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/coreclr/utilcode/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ bool _DbgBreakCheck(
if (formattedMessages)
{
OutputDebugStringUtf8(formatBuffer);
minipal_log_print_error(formatBuffer);
minipal_log_print_error("%s", formatBuffer);
Copy link

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing a format string explicitly ensures that the error message from formatBuffer is displayed correctly without format string errors.

Copilot uses AI. Check for mistakes.
}
else
{
Expand Down Expand Up @@ -489,7 +489,7 @@ void DECLSPEC_NORETURN __FreeBuildAssertFail(const char *szFile, int iLine, cons
OutputDebugStringUtf8(buffer.GetUTF8());

// Write out the error to the console
minipal_log_print_error(buffer.GetUTF8());
minipal_log_print_error("%s", buffer.GetUTF8());
Copy link

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update ensures that the error message is printed correctly by using an explicit format string.

Copilot uses AI. Check for mistakes.

// Log to the stress log. Note that we can't include the szExpr b/c that
// may not be a string literal (particularly for formatt-able asserts).
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/classcompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ InteropMethodTableData *MethodTableBuilder::BuildInteropVTable(AllocMemTracker *
message.AppendUTF8((LPCUTF8) qb.Ptr());
message.AppendUTF8("\n");

minipal_log_print_info(message.GetUTF8());
minipal_log_print_info("%s", message.GetUTF8());
Copy link

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to include a format string prevents the message from being incorrectly parsed as a format specifier.

Suggested change
minipal_log_print_info("%s", message.GetUTF8());
minipal_log_print_info(message.GetUTF8());

Copilot uses AI. Check for mistakes.
message.Clear();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/frames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@ static void DumpGCRefMap(const char *name, BYTE *address)
}
buf.AppendUTF8("\n");

minipal_log_print_info(buf.GetUTF8());
minipal_log_print_info("%s", buf.GetUTF8());
Copy link

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an explicit format string (%s) ensures that the logged message is formatted correctly instead of being misinterpreted as a format string.

Copilot uses AI. Check for mistakes.
}
#endif

Expand Down
Loading