Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit a1b6164

Browse files
authored
windows: call to FormatMessage() should _IGNORE_INSERTS (#849)
Calling FormatMessage without a FORMAT_MESSAGE_IGNORE_INSERTS flag could cause trouble, as explained in an article by Raymond Chen: * The importance of the FORMAT_MESSAGE_IGNORE_INSERTS flag https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
1 parent 278ed96 commit a1b6164

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/glog/logging.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,8 @@ DECLARE_bool(log_utc_time);
596596
LPSTR message = NULL; \
597597
LPSTR msg = reinterpret_cast<LPSTR>(&message); \
598598
DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
599-
FORMAT_MESSAGE_FROM_SYSTEM, \
599+
FORMAT_MESSAGE_FROM_SYSTEM | \
600+
FORMAT_MESSAGE_IGNORE_INSERTS, \
600601
0, result, 0, msg, 100, NULL); \
601602
if (message_length > 0) { \
602603
@ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \

0 commit comments

Comments
 (0)